Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio and video stream ID in variant tracks #843

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Jonas Birmé <[email protected]>
Jono Ward <[email protected]>
Jozef Chúťka <[email protected]>
Lucas Gabriel Sánchez <[email protected]>
Matias Russitto <[email protected]>
Mattias Wadman <[email protected]>
Natalie Harris <[email protected]>
Nick Desaulniers <[email protected]>
Expand Down
8 changes: 7 additions & 1 deletion externs/shaka/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ shakaExtern.Stats;
* audioCodec: ?string,
* videoCodec: ?string,
* primary: boolean,
* roles: !Array.<string>
* roles: !Array.<string>,
* videoId: ?number,
* audioId: ?number
* }}
*
* @description
Expand Down Expand Up @@ -190,6 +192,10 @@ shakaExtern.Stats;
* cannot be satisfied.
* @property {!Array.<string>} roles
* The roles of the track, e.g. 'main', 'caption', or 'commentary'.
* @property {?number} videoId
* (only for variant tracks) The video stream id.
* @property {?number} audioId
* (only for variant tracks) The audio stream id.
* @exportDoc
*/
shakaExtern.Track;
Expand Down
4 changes: 3 additions & 1 deletion lib/util/stream_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ shaka.util.StreamUtils.getVariantTracks =
audioCodec: audioCodec,
videoCodec: videoCodec,
primary: variant.primary,
roles: roles
roles: roles,
videoId: variant.video ? variant.video.id : null,
audioId: variant.audio ? variant.audio.id : null
};
});

Expand Down
4 changes: 3 additions & 1 deletion test/offline/storage_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ describe('Storage', function() {
codecs: 'avc1.4d401f, vorbis',
audioCodec: 'vorbis',
videoCodec: 'avc1.4d401f',
roles: []
roles: [],
videoId: 0,
audioId: 1
}
];
Promise
Expand Down
20 changes: 15 additions & 5 deletions test/player_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,9 @@ describe('Player', function() {
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
primary: false,
roles: []
roles: [],
videoId: 4,
audioId: 1
},
{
id: 2,
Expand All @@ -866,7 +868,9 @@ describe('Player', function() {
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
primary: false,
roles: []
roles: [],
videoId: 5,
audioId: 1
},
{
id: 3,
Expand All @@ -884,7 +888,9 @@ describe('Player', function() {
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
primary: false,
roles: []
roles: [],
videoId: 4,
audioId: 2
},
{
id: 4,
Expand All @@ -902,7 +908,9 @@ describe('Player', function() {
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
primary: false,
roles: []
roles: [],
videoId: 5,
audioId: 2
},
{
id: 5,
Expand All @@ -920,7 +928,9 @@ describe('Player', function() {
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
primary: false,
roles: []
roles: [],
videoId: 5,
audioId: 8
}
];

Expand Down