Skip to content

视频是m3u8格式的,一定要自动播放才能正常显示视频,如果是设置autoplay为false,点击播放按钮,播放容器是黑屏的 #231

Description

@xiaoketeng

视频是m3u8格式的,一定要自动播放才能正常显示视频,如果是设置autoplay为false,点击播放按钮,播放容器是黑屏的

设置为autoplay为true,为正常的
`import React, { Component } from 'react';
import Player from 'griffith';

class LiveM3u8 extends Component {
state = {};

testEvent = e => {
console.log(e, 'testEvent');
}

render()

{

const { id, title, cover, src } = this.props;
const sources = {
  auto: {
    format: src.indexOf('m3u8') > -1 ? 'm3u8' : 'mp4',
    play_url: src,
  },
};
const props = {
  id,
  title,
  standalone: true,
  cover,
  initialObjectFit: 'cover',
  sources,
  shouldObserveResize: true,
  disablePictureInPicture: true,
  autoplay: (src.indexOf('m3u8') > -1),
  hiddenPlayButton: false,
  hiddenTimeline: false,
  hiddenTime: false,
  onEvent: this.testEvent,
};
return (
  <Player {...props} />
)

}
}

export default LiveM3u8;
`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug🐛Something isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions