Skip to content

Commit

Permalink
feat: 🎸 (xgplayer-hlsjs) 播放器配置适配hls.js fixed #1664
Browse files Browse the repository at this point in the history
  • Loading branch information
gemxx committed Dec 2, 2024
1 parent 67194ee commit 0655c9d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/xgplayer-hls.js/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,23 @@ class HlsJsPlugin extends BasePlugin {
this.player.handleSource = false // 关闭player源处理
}

/**
* @private
*/
_adaptHlsJsConfig (hlsOpts = {}) {
const { playerConfig } = this

if (!hlsOpts?.startPosition && typeof playerConfig.startTime === 'number') {
hlsOpts.startPosition = playerConfig.startTime
}

return hlsOpts
}

afterCreate () {
const { hlsOpts } = this.config
this.hlsOpts = hlsOpts
this.hlsOpts = this._adaptHlsJsConfig(hlsOpts)

this.on(Events.URL_CHANGE, (url) => {
if (/^blob/.test(url)) {
return
Expand Down

0 comments on commit 0655c9d

Please sign in to comment.