简体   繁体   English

如何在 react-hls-player 中使用 hlsConfig

[英]how to use hlsConfig in react-hls-player

I came across https://www.npmjs.com/package/react-hls-player where it is mentioned how to use hls player in reactjs This is sample code i have written but i couldn't figureout how to use hlsConfig object.我遇到了https://www.npmjs.com/package/react-hls-player ,其中提到了如何在 reactjs 中使用 hls 播放器这是我编写的示例代码,但我无法弄清楚如何使用hlsConfig对象。 Can someone help me how and where to use hlsConfig object ?有人可以帮助我如何以及在何处使用 hlsConfig 对象吗?

import React from 'react';
import ReactHlsPlayer from 'react-hls-player'

export default class HLSPlayer extends React.Component {


render() {
    return (
        <ReactHlsPlayer
            url='https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8'
            autoplay={true}
            controls={true}
            width="1200"
            height="auto"
        />

    )
}

} }

The document is saying you can use all the options available here https://github.com/video-dev/hls.js/blob/master/docs/API.md#fine-tuning .该文件说您可以使用此处提供的所有选项https://github.com/video-dev/hls.js/blob/master/docs/API.md#fine-tuning Here is an example:下面是一个例子:

<ReactHlsPlayer
  url='https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8'
  autoplay={true}
  controls={true}
  width="1200"
  height="auto"
  hlsConfig={{
    autoStartLoad: true,
    startPosition: -1,
    debug: false,
    // ...
  }}
/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM