Skip to content

Commit

Permalink
fix: 🐛 修复移动浏览器下muted未显示设置在dom内,会导致非静音切换频地址后开播失败的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
gemxx committed Sep 20, 2023
1 parent 2a8c2dc commit 1d16d70
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/xgplayer/src/mediaProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ class MediaProxy extends EventEmitter {
this.mediaConfig.loop = 'loop'
}

// Warning:一些移动端浏览器需要设置DOM属性,否则会导致非静音切换频地址后开播失败
if (options.autoplayMuted && !Object.prototype.hasOwnProperty.call(this.mediaConfig, 'muted')) {
this.mediaConfig.muted = true
}

/**
* @type { HTMLVideoElement | HTMLAudioElement | HTMLElement | IMediaProxy | null }
*/
Expand Down

0 comments on commit 1d16d70

Please sign in to comment.