File tree Expand file tree Collapse file tree
chrome/player/players/mp4 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,14 +76,18 @@ export default class MP4Player extends EventEmitter {
7676 makeSourceBuffers ( ) {
7777 const videoTrack = this . metaData . videoTracks [ this . currentVideoTrack ] ;
7878 if ( videoTrack ) {
79- const videoCodec = 'video/mp4; codecs=\"' + videoTrack . codec . toLowerCase ( ) + '\"' ;
79+ const videoCodec = 'video/mp4; codecs=\"' + videoTrack . codec + '\"' ;
8080 this . videoSourceBuffer = new SourceBufferWrapper ( this . mediaSource , videoCodec ) ;
8181 }
8282
8383 if ( this . currentAudioTrack !== null ) {
8484 const audioTrack = this . metaData . audioTracks [ this . currentAudioTrack ] ;
8585 if ( audioTrack ) {
86- const audioCodec = 'audio/mp4; codecs=\"' + audioTrack . codec . toLowerCase ( ) + '\"' ;
86+ let fixedCode = audioTrack . codec ;
87+ if ( fixedCode === 'Opus' ) {
88+ fixedCode = 'opus' ;
89+ }
90+ const audioCodec = 'audio/mp4; codecs=\"' + fixedCodec + '\"' ;
8791 this . audioSourceBuffer = new SourceBufferWrapper ( this . mediaSource , audioCodec ) ;
8892 }
8993 }
@@ -102,7 +106,12 @@ export default class MP4Player extends EventEmitter {
102106
103107 setupHLS ( ) {
104108 this . removeSourceBuffers ( ) ;
105- this . makeSourceBuffers ( ) ;
109+ try {
110+ this . makeSourceBuffers ( ) ;
111+ } catch ( e ) {
112+ this . emit ( DefaultPlayerEvents . ERROR , 'Failed to create SourceBuffers: ' + e . message ) ;
113+ return ;
114+ }
106115
107116 this . mp4box . fragmentedTracks . length = 0 ;
108117
You can’t perform that action at this time.
0 commit comments