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 { ...@@ -187,9 +187,7 @@ export default class MasterPlaylistController extends videojs.EventTarget {
187 Object.keys(mediaGroups.AUDIO).length === 0 || 187 Object.keys(mediaGroups.AUDIO).length === 0 ||
188 this.mode_ !== 'html5') { 188 this.mode_ !== 'html5') {
189 // "main" audio group, track name "default" 189 // "main" audio group, track name "default"
190 mediaGroups = videojs.mergeOptions(mediaGroups, {AUDIO: { 190 mediaGroups.AUDIO = {main: {default: {default: true }}};
191 main: {default: {default: true}}}
192 });
193 } 191 }
194 192
195 let tracks = {}; 193 let tracks = {};
......
...@@ -1643,6 +1643,34 @@ QUnit.test('adds 1 default audio track if we have not parsed any, and the playli ...@@ -1643,6 +1643,34 @@ QUnit.test('adds 1 default audio track if we have not parsed any, and the playli
1643 QUnit.ok(this.player.audioTracks()[0] instanceof HlsAudioTrack, 'audio track is an hls audio track'); 1643 QUnit.ok(this.player.audioTracks()[0] instanceof HlsAudioTrack, 'audio track is an hls audio track');
1644 }); 1644 });
1645 1645
1646 QUnit.test('adds 1 default audio track if in flash mode', function() {
1647 let hlsOptions = videojs.options.hls;
1648
1649 this.player.dispose();
1650 videojs.options.hls = {
1651 mode: 'flash'
1652 };
1653
1654 this.player = createPlayer();
1655
1656 this.player.src({
1657 src: 'manifest/multipleAudioGroups.m3u8',
1658 type: 'application/vnd.apple.mpegurl'
1659 });
1660
1661 QUnit.equal(this.player.audioTracks().length, 0, 'zero audio tracks at load time');
1662
1663 openMediaSource(this.player, this.clock);
1664
1665 // master
1666 standardXHRResponse(this.requests.shift());
1667
1668 QUnit.equal(this.player.audioTracks().length, 1, 'one audio track after load');
1669 QUnit.ok(this.player.audioTracks()[0] instanceof HlsAudioTrack, 'audio track is an hls audio track');
1670
1671 videojs.options.hls = hlsOptions;
1672 });
1673
1646 QUnit.test('adds audio tracks if we have parsed some from a playlist', function() { 1674 QUnit.test('adds audio tracks if we have parsed some from a playlist', function() {
1647 this.player.src({ 1675 this.player.src({
1648 src: 'manifest/multipleAudioGroups.m3u8', 1676 src: 'manifest/multipleAudioGroups.m3u8',
......