【问题标题】:how to use hlsConfig in react-hls-player如何在 react-hls-player 中使用 hlsConfig
【发布时间】:2020-09-01 17:32:55
【问题描述】:

我遇到了https://www.npmjs.com/package/react-hls-player,其中提到了如何在 reactjs 中使用 hls 播放器 这是我编写的示例代码,但我不知道如何使用hlsConfig 对象。有人可以帮我如何以及在哪里使用 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"
        />

    )
}

}

【问题讨论】:

    标签: reactjs http-live-streaming hls.js


    【解决方案1】:

    文档说您可以使用此处https://github.com/video-dev/hls.js/blob/master/docs/API.md#fine-tuning 提供的所有选项。这是一个例子:

    <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,
        // ...
      }}
    />
    

    【讨论】:

      猜你喜欢
      • 2022-08-09
      • 2020-07-06
      • 1970-01-01
      • 2023-01-30
      • 2020-02-18
      • 2022-06-16
      • 1970-01-01
      • 2021-02-17
      • 1970-01-01
      相关资源
      最近更新 更多