Skip to content

Commit

Permalink
add video and audio stream IDs for getStats().switchHistory (#846)
Browse files Browse the repository at this point in the history
Closes #785, #823
  • Loading branch information
russitto authored and joeyparrish committed Jun 5, 2017
1 parent 251c44d commit 6b00bcd
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
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 @@ -803,7 +803,9 @@ describe('Player', function() {
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
primary: false,
roles: []
roles: [],
videoId: 4,
audioId: 1
},
{
id: 2,
Expand All @@ -821,7 +823,9 @@ describe('Player', function() {
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
primary: false,
roles: []
roles: [],
videoId: 5,
audioId: 1
},
{
id: 3,
Expand All @@ -839,7 +843,9 @@ describe('Player', function() {
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
primary: false,
roles: []
roles: [],
videoId: 4,
audioId: 2
},
{
id: 4,
Expand All @@ -857,7 +863,9 @@ describe('Player', function() {
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
primary: false,
roles: []
roles: [],
videoId: 5,
audioId: 2
},
{
id: 5,
Expand All @@ -875,7 +883,9 @@ describe('Player', function() {
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
primary: false,
roles: []
roles: [],
videoId: 5,
audioId: 8
}
];

Expand Down

0 comments on commit 6b00bcd

Please sign in to comment.