首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >“视频播放器正在加载”“这是一个模式窗口”-如何删除react videojs .m3u8流中不需要的文本

“视频播放器正在加载”“这是一个模式窗口”-如何删除react videojs .m3u8流中不需要的文本
EN

Stack Overflow用户
提问于 2020-09-18 17:00:38
回答 1查看 801关注 0票数 0

我正在react JS页面中嵌入一个.m3u8流。我正在使用video.js,并且有一些不需要的文本显示,我就是不能删除!文本在两行上显示"Video Player is loading“,然后是"This is a modal window”。如下图所示(蓝色方框包含视频)。

一旦加载了视频,文本就不会消失,我无法弄清楚它为什么会出现在第一个地方。如果有人知道如何删除这篇文章,那就太棒了。谢谢。

请在下面找到我的代码。它基本上是从文档中复制和粘贴的:https://docs.videojs.com/tutorial-react.html

代码语言:javascript
复制
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>
        );
    }
}
EN

回答 1

Stack Overflow用户

发布于 2020-09-21 21:33:16

我刚刚发现,"Video player is loading“和"This is a modal window”这两行文本可以通过在videoOptions定义中添加以下行来分别删除:

代码语言:javascript
复制
loadingSpinner: false,
errorDisplay: false,
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63952598

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档