由于 Chrome 上的损坏问题,媒体播放中止 - video.js

问题描述

我使用的是 video.js 库版本 7.11.8 和 react 版本 17.0.2。我在移动 Chrome 浏览器中遇到以下错误。此问题不一致,但经常发生。我已参考 https://github.com/videojs/http-streaming/issues/143,但没有帮助。 下面是我的代码

const videoJSOptions = {
        autoplay: false,controls: true,nativeControlsForTouch: true,preload: 'Metadata',sources: [{
            src: `${props.item.videoUrl}`,type: 'video/mp4'
        }],id: props.item.id,};

useEffect(() => {
        const player = videojs(playerRef.current,videoJSOptions,() => {
            player.on("play",() => {
         
            });
    
            player.on("pause",() => {
                
            });
           
            return () => {
                if (player) {
                    player.dispose();
                }
            }
        });
    },[videoJSOptions.sources.src]);

return (
   <div>
      <video id={props.item.id} ref={playerRef} className="video-js vjs-big-play-centered" {...props} controls disablePictureInPicture  controlsList="nodownload noremoteplayback"></video>
   </div>
)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)