Skip to content

Commit 6b00bcd

Browse files
russittojoeyparrish
authored andcommitted
add video and audio stream IDs for getStats().switchHistory (#846)
Closes #785, #823
1 parent 251c44d commit 6b00bcd

File tree

5 files changed

+29
-8
lines changed

5 files changed

+29
-8
lines changed

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Jonas Birmé <jonas.birme@eyevinn.se>
4040
Jono Ward <jonoward@gmail.com>
4141
Jozef Chúťka <jozefchutka@gmail.com>
4242
Lucas Gabriel Sánchez <unkiwii@gmail.com>
43+
Matias Russitto <russitto@gmail.com>
4344
Mattias Wadman <mattias.wadman@gmail.com>
4445
Natalie Harris <natalieharris@google.com>
4546
Nick Desaulniers <nick@mozilla.com>

externs/shaka/player.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ shakaExtern.Stats;
140140
* audioCodec: ?string,
141141
* videoCodec: ?string,
142142
* primary: boolean,
143-
* roles: !Array.<string>
143+
* roles: !Array.<string>,
144+
* videoId: ?number,
145+
* audioId: ?number
144146
* }}
145147
*
146148
* @description
@@ -190,6 +192,10 @@ shakaExtern.Stats;
190192
* cannot be satisfied.
191193
* @property {!Array.<string>} roles
192194
* The roles of the track, e.g. 'main', 'caption', or 'commentary'.
195+
* @property {?number} videoId
196+
* (only for variant tracks) The video stream id.
197+
* @property {?number} audioId
198+
* (only for variant tracks) The audio stream id.
193199
* @exportDoc
194200
*/
195201
shakaExtern.Track;

lib/util/stream_utils.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ shaka.util.StreamUtils.getVariantTracks =
268268
audioCodec: audioCodec,
269269
videoCodec: videoCodec,
270270
primary: variant.primary,
271-
roles: roles
271+
roles: roles,
272+
videoId: variant.video ? variant.video.id : null,
273+
audioId: variant.audio ? variant.audio.id : null
272274
};
273275
});
274276

test/offline/storage_unit.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ describe('Storage', function() {
145145
codecs: 'avc1.4d401f, vorbis',
146146
audioCodec: 'vorbis',
147147
videoCodec: 'avc1.4d401f',
148-
roles: []
148+
roles: [],
149+
videoId: 0,
150+
audioId: 1
149151
}
150152
];
151153
Promise

test/player_unit.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,9 @@ describe('Player', function() {
803803
audioCodec: 'mp4a.40.2',
804804
videoCodec: 'avc1.4d401f',
805805
primary: false,
806-
roles: []
806+
roles: [],
807+
videoId: 4,
808+
audioId: 1
807809
},
808810
{
809811
id: 2,
@@ -821,7 +823,9 @@ describe('Player', function() {
821823
audioCodec: 'mp4a.40.2',
822824
videoCodec: 'avc1.4d401f',
823825
primary: false,
824-
roles: []
826+
roles: [],
827+
videoId: 5,
828+
audioId: 1
825829
},
826830
{
827831
id: 3,
@@ -839,7 +843,9 @@ describe('Player', function() {
839843
audioCodec: 'mp4a.40.2',
840844
videoCodec: 'avc1.4d401f',
841845
primary: false,
842-
roles: []
846+
roles: [],
847+
videoId: 4,
848+
audioId: 2
843849
},
844850
{
845851
id: 4,
@@ -857,7 +863,9 @@ describe('Player', function() {
857863
audioCodec: 'mp4a.40.2',
858864
videoCodec: 'avc1.4d401f',
859865
primary: false,
860-
roles: []
866+
roles: [],
867+
videoId: 5,
868+
audioId: 2
861869
},
862870
{
863871
id: 5,
@@ -875,7 +883,9 @@ describe('Player', function() {
875883
audioCodec: 'mp4a.40.2',
876884
videoCodec: 'avc1.4d401f',
877885
primary: false,
878-
roles: []
886+
roles: [],
887+
videoId: 5,
888+
audioId: 8
879889
}
880890
];
881891

0 commit comments

Comments
 (0)