Skip to content

Commit

Permalink
feat(mediaComposition): exposes the media URN through the main resources
Browse files Browse the repository at this point in the history
Today, it's not possible to retrieve the identifier of the media currently being
 played. In some cases, however, this information may be of interest to the
 developer. This modification fills the gap by exposing the URN through the
 `mediaData` object accessible from the player current source.

 ```javascript
 // Access the media URN
 player.currentSource().mediaData.urn
 ```

- add `urn` property to `mediaComposition.getMainResources`
- update `getMainResources` test case to ensure that the urn property is exposed
  • Loading branch information
amtins committed Feb 23, 2024
1 parent a50f20d commit 4b4c5a5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/dataProvider/model/MediaComposition.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ class MediaComposition {
streamOffset: resource.streamOffset,
tokenType: resource.tokenType,
url: resource.url,
urn: this.chapterUrn
}));
}

Expand Down
1 change: 1 addition & 0 deletions test/dataProvider/model/MediaComposition.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ describe('MediaComposition', () => {
expect(resource).toHaveProperty('streamOffset');
expect(resource).toHaveProperty('tokenType');
expect(resource).toHaveProperty('url');
expect(resource).toHaveProperty('urn');
});

it('should return the main resources for an on demand video', () => {
Expand Down

0 comments on commit 4b4c5a5

Please sign in to comment.