2700601b by forbesjo Committed by Brandon Casey

Use a single default audio track when not in html5 mode (#702)

* Added test for multiple audio groups in flash
* Use a single default audio track when not in html5 mode
1 parent 1565f670
......@@ -187,9 +187,7 @@ export default class MasterPlaylistController extends videojs.EventTarget {
Object.keys(mediaGroups.AUDIO).length === 0 ||
this.mode_ !== 'html5') {
// "main" audio group, track name "default"
mediaGroups = videojs.mergeOptions(mediaGroups, {AUDIO: {
main: {default: {default: true}}}
});
mediaGroups.AUDIO = {main: {default: {default: true }}};
}
let tracks = {};
......
......@@ -1643,6 +1643,34 @@ QUnit.test('adds 1 default audio track if we have not parsed any, and the playli
QUnit.ok(this.player.audioTracks()[0] instanceof HlsAudioTrack, 'audio track is an hls audio track');
});
QUnit.test('adds 1 default audio track if in flash mode', function() {
let hlsOptions = videojs.options.hls;
this.player.dispose();
videojs.options.hls = {
mode: 'flash'
};
this.player = createPlayer();
this.player.src({
src: 'manifest/multipleAudioGroups.m3u8',
type: 'application/vnd.apple.mpegurl'
});
QUnit.equal(this.player.audioTracks().length, 0, 'zero audio tracks at load time');
openMediaSource(this.player, this.clock);
// master
standardXHRResponse(this.requests.shift());
QUnit.equal(this.player.audioTracks().length, 1, 'one audio track after load');
QUnit.ok(this.player.audioTracks()[0] instanceof HlsAudioTrack, 'audio track is an hls audio track');
videojs.options.hls = hlsOptions;
});
QUnit.test('adds audio tracks if we have parsed some from a playlist', function() {
this.player.src({
src: 'manifest/multipleAudioGroups.m3u8',
......