Skip to content

Commit

Permalink
Add documentation on ID3 parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
dsilhavy committed Feb 23, 2024
1 parent 4348fc0 commit e224cba
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions pages/advanced/event-handling.md
Expand Up @@ -19,16 +19,20 @@ dash.js supports inline and inband events included in the MPD and the media segm
timing and how to use them please checkout ISO/IEC 23009-1 and the DASH-IF IOP Guidelines.

## Example
An example is available as part of the [sample section](https://reference.dashif.org/dash.js/nightly/samples/advanced/listening-to-SCTE-EMSG-events.html).

An example is available as part of
the [sample section](https://reference.dashif.org/dash.js/nightly/samples/advanced/listening-to-SCTE-EMSG-events.html).

## Inband Events
Inband events are events that are included in the ISOBMFF segments as an `emsg` box.

Inband events are events that are included in the ISOBMFF segments as an `emsg` box.
The `schemeIdUri` and the `value` of inband events need to be signaled in the MPD using an `InbandEventStream` element.

An example of an `InbandEventStream` element and the structure of the `emsg` box are depicted below:

```xml
<InbandEventStream schemeIdUri="urn:scte:scte35:2013:xml" value="999" />

<InbandEventStream schemeIdUri="urn:scte:scte35:2013:xml" value="999"/>
```

```
Expand Down Expand Up @@ -58,7 +62,8 @@ MPD events are signaled directly in the MPD. Events of the same type are summari
An example of an MPD event is depicted below.

```xml
<EventStream schemeIdUri="urn:scte:scte35:2013:xml" value="999" >

<EventStream schemeIdUri="urn:scte:scte35:2013:xml" value="999">
<Event duration="1" presentationTime="10">someMessage</Event>
</EventStream>
```
Expand All @@ -67,15 +72,16 @@ An example of an MPD event is depicted below.

### Application events

dash.js dispatches events that are not directly processed by the player (application events) to the underlying application. To register for a specific type
dash.js dispatches events that are not directly processed by the player (application events) to the underlying
application. To register for a specific type
of event use the `on` method of the `player` object and specify the target `schemeIdUri` to listen for:

```javascript
const SCHEMEIDURI = "urn:scte:scte35:2013:xml";
const EVENT_MODE_ON_START = dashjs.MediaPlayer.events.EVENT_MODE_ON_START;
const EVENT_MODE_ON_RECEIVE = dashjs.MediaPlayer.events.EVENT_MODE_ON_RECEIVE;

player.on(SCHEMEIDURI, showStartEvent, null);
player.on(SCHEMEIDURI, showStartEvent, null);
player.on(SCHEMEIDURI, showReceiveEvent, null, { mode: EVENT_MODE_ON_RECEIVE });
```

Expand All @@ -93,3 +99,22 @@ Some events are to be processed by the DASH player directly and are not dispatch
| `urn:mpeg:dash:event:2012` | 1 | Triggers and MPD reload |
| `urn:mpeg:dash:event:callback:2015` | 1 | Sends a callback request to the provided URL ignoring the response |

### ID3 parsing

dash.js uses the [Common Media Library](https://github.com/streaming-video-technology-alliance/common-media-library) to
support the parsing of ID3 time metadata for inband events. ID3 time metadata is signaled via
the `https://aomedia.org/emsg/ID3` `schemeIdUri`. The parsed message data is dispatched via
the `event.parsedMessageData`
field. The raw ID3 message data is available via the `event.messageData` field. As an example:

````js
event.messageData = Uint8Array(89)[
...]
event.parsedMessageData = [
{
"key": "PRIV",
"info": "com.elementaltechnologies.timestamp.utc",
"data": {}
}
]
````

0 comments on commit e224cba

Please sign in to comment.