Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xiaoketeng opened this issue Oct 29, 2021 · 2 comments
Labels
bug🐛 Something isn't working

Comments

@xiaoketeng
Copy link

视频是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;
`

@a1782680475
Copy link

考,我也是这个毛病,请问怎么解决的?

@ambar ambar added the bug🐛 Something isn't working label Jan 19, 2022
@ambar
Copy link
Collaborator

ambar commented Jan 20, 2022

原生支持 HLS 有 autoplay 无 autoplay
Chrome N Y N*
Safari Y Y* Y*
Firefox N Y Y

Safari 能播放但额外存在 loading 提示卡住的问题

Chrome 无 autoplay 加载:

  • 改用 autoStartLoad: true 参数提供给 hls,播放正常
  • 手动调用 hls.startLoad(),然后再点击「播放」,播放正常
  • 直接点击「播放」,提示 GET blob:url net::ERR_FILE_NOT_FOUND (内部仍然调用了 hls.startLoad(),但结果不对)

NOTE: 与 hls 版本无关(升级到 1.x 仍然存在 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants