当我使用videojs在手机上播放m3u8时。 它可以在android或13以下的ios上正常运行,但在ios 13+上,可能会导致错误
VIDEOJS: ERROR: (CODE:3 MEDIA_ERR_DECODE) The media playback was aborted due to a corruption problem or because the media used features your browser did not support
如果您使用player.load()
一次或两次,该问题将得到解决。
视频标签如下:
<video id="videobox" class="video-js vjs-default-skin vjs-big-play-centered vjs-16-9" muted="true"
data-setup="{}">
<source :src="videoSrc" type="application/x-mpegURL">
</video>
方法是这样的。
beginPlay() {
let ctx = this;
this.videobox = videojs('videobox', {
bigPlayButton: false,
textTrackDisplay: true,
posterImage: false,
errorDisplay: false,
controls: true,
autoplay: true,
playbackRates: [0.5, 1, 1.5, 2],
},
function onPlayerReady() {
this.play();
});
}
beforeDestroy() {
this.videobox.dispose();
clearInterval(this.timeClk)
}