Skip to content

Commit

Permalink
feat: parse ID3 payload for inband events (#4391)
Browse files Browse the repository at this point in the history
* feat: parse ID3 payload for inband events
  • Loading branch information
littlespex committed Feb 23, 2024
1 parent 86917b6 commit 4e4bbc6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/dash/DashAdapter.js
Expand Up @@ -39,6 +39,8 @@ import DashManifestModel from './models/DashManifestModel.js';
import PatchManifestModel from './models/PatchManifestModel.js';
import Representation from './vo/Representation.js';
import {bcp47Normalize} from 'bcp-47-normalize';
import {getId3Frames} from '@svta/common-media-library/id3/getId3Frames.js';
import Constants from '../streaming/constants/Constants.js';

/**
* @module DashAdapter
Expand Down Expand Up @@ -465,6 +467,7 @@ function DashAdapter() {
event.calculatedPresentationTime = calculatedPresentationTime;
event.messageData = messageData;
event.presentationTimeDelta = presentationTimeDelta;
event.parsedMessageData = (schemeIdUri === Constants.ID3_SCHEME_ID_URI) ? getId3Frames(messageData) : null;

return event;
} catch (e) {
Expand Down
1 change: 1 addition & 0 deletions src/dash/vo/Event.js
Expand Up @@ -41,6 +41,7 @@ class Event {
this.messageData = '';
this.eventStream = null;
this.presentationTimeDelta = NaN; // Specific EMSG Box parameter
this.parsedMessageData = null; // Parsed value of the event message
}
}

Expand Down
9 changes: 8 additions & 1 deletion src/streaming/constants/Constants.js
Expand Up @@ -274,6 +274,13 @@ export default {
},
ABANDON_FRAGMENT_RULES: {
ABANDON_REQUEST_RULE: 'AbandonRequestsRule'
}
},

/**
* @constant {string} ID3_SCHEME_ID_URI specifies scheme ID URI for ID3 timed metadata
* @memberof Constants#
* @static
*/
ID3_SCHEME_ID_URI: 'https://aomedia.org/emsg/ID3'
}

0 comments on commit 4e4bbc6

Please sign in to comment.