我正在react JS页面中嵌入一个.m3u8流。我正在使用video.js,并且有一些不需要的文本显示,我就是不能删除!文本在两行上显示"Video Player is loading“,然后是"This is a modal window”。如下图所示(蓝色方框包含视频)。
一旦加载了视频,文本就不会消失,我无法弄清楚它为什么会出现在第一个地方。如果有人知道如何删除这篇文章,那就太棒了。谢谢。
请在下面找到我的代码。它基本上是从文档中复制和粘贴的:https://docs.videojs.com/tutorial-react.html

import React, { Component } from 'react';
import { connect } from 'react-redux'
import videojs from 'video.js';
import 'video.js/dist/video-js.css';
//import 'videojs-contrib-hls/dist/videojs-contrib-hls.js';
// Workaround for webworkify not working with webpack
window.videojs = videojs;
require('videojs-contrib-hls/dist/videojs-contrib-hls.js');
class VideoPlayer extends Component {
componentDidMount() {
// instantiate Video.js
this.player = videojs(this.videoNode, this.props, function onPlayerReady() {
console.log('onPlayerReady', this)
});
}
// destroy player on unmount
componentWillUnmount() {
if (this.player) {
this.player.dispose()
}
}
// wrap the player in a div with a `data-vjs-player` attribute
// so videojs won't create additional wrapper in the DOM
// see https://github.com/videojs/video.js/pull/3856
render() {
return (
<div>
<div data-vjs-player>
<video ref={ node => this.videoNode = node } className="video-js"></video>
</div>
</div>
)
}
}
class videoWidget extends Component {
render() {
const videoOptions = {
autoplay: true,
textTrackSettings: false,
bigPlayButton: false,
controlBar: false,
sources: [{
src: 'http://my-source-url.m3u8',
type: "application/x-mpegURL"
}],
}
return (
<div>
<VideoPlayer {...videoOptions} />
</div>
);
}
}发布于 2020-09-21 21:33:16
我刚刚发现,"Video player is loading“和"This is a modal window”这两行文本可以通过在videoOptions定义中添加以下行来分别删除:
loadingSpinner: false,
errorDisplay: false,https://stackoverflow.com/questions/63952598
复制相似问题