Core Concepts

The fundamental ingredients in a Norsk Media application are as follows:

  • Media Nodes - the components that ingest, manipulate, and publish media

  • Contexts - data structures that contain details of what is in any given media stream (what audio, video, subtitles etc.)

  • Subscriptions - these join Media Nodes together so that the output of one Media Node can be used as an input for one or more downstream Media Nodes.

You will have already seen nodes and subscriptions in the examples covered here - and if you’ve looked at the examples repo you may have seen code that rummaged around in context structures to help drive the business logic in that example.

Norsk sets up subscriptions by calling your subscription callback function every time a context changes. This allows your code to react to changes in what is being received. So for example, when a new media source (be that RTMP, SRT, etc.) connects, a context is generated that tells you what that input contains. Should the contents change, Norsk will call the callback again with a fresh context giving the latest details.

The SDK provides several standard callbacks (such as selectVideo, selectAudio, selectAV, selectSubtitles, etc.) that probably do what you need - but the callbacks are straightforward, and it is easy to write your own versions that contain custom business logic specific to your particular application.