Skip to content

Commit

Permalink
set Mp4Plugin support Apple's MMS
Browse files Browse the repository at this point in the history
fix issue #1578

使MP4插件支持苹果ios17 的MMS。
默认关闭 需要在配置中打开:
{
plugins: [Mp4Plugin],

    // set mp4Plugin support Apple's MMS
    mp4Plugin: {
      preferMMS: true
    }
}
  • Loading branch information
zzzhr1990 authored and gemxx committed Sep 5, 2024
1 parent 279e788 commit 6bacba4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
9 changes: 8 additions & 1 deletion fixtures/mp4/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,14 @@
// },
height: window.innerHeight -300,
width: window.innerWidth,
// plugins: [Mp4Plugin]
preferMMS: true,
waitingInBufferTimeOut: 5001,
//plugins: [Mp4Plugin],

// set mp4Plugin support Apple's MMS
//mp4Plugin: {
// preferMMS: true,
//}
});
window.player = player

Expand Down
4 changes: 3 additions & 1 deletion packages/xgplayer-mp4/src/mp4.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class MP4 extends EventEmitter {
enableWorker: false,
playerId: '',
vid: '',
ext: {}
ext: {},
preferMMS: false
}
}
/**
Expand Down Expand Up @@ -66,6 +67,7 @@ class MP4 extends EventEmitter {
retryDelay: this.options.retryDelay,
timeout: this.options.timeout,
...options.reqOptions,
preferMMS: this.options.preferMMS,
openLog: checkOpenLog()
})
this.fMP4Demuxer = null
Expand Down
6 changes: 4 additions & 2 deletions packages/xgplayer-mp4/src/mp4Plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export default class Mp4Plugin extends BasePlugin {
waitJampBufferMaxCnt:3,
tickInSeconds: 0.1,
reqOptions: null,
closeDowngrade: false
closeDowngrade: false,
preferMMS: false
}
}

Expand Down Expand Up @@ -381,7 +382,8 @@ export default class Mp4Plugin extends BasePlugin {
}

const contentTypes = { [MSE.VIDEO]: { mimeType: 'video/mp4', codec } }
this.mse = new MSE()

this.mse = new MSE(null, { preferMMS: this.config.preferMMS })
const openPromise = this.mse.bindMedia(this.player.video)
openPromise.then(()=> {
const contentTypesLocal = Object.keys(contentTypes)
Expand Down

0 comments on commit 6bacba4

Please sign in to comment.