search

Home  >  Q&A  >  body text

javascript - Problems with mobile on-demand and live broadcast players?

reason:

公司做课程直播,也就是直播讲课,但是只有音频直播没有视频。

need:

在微信端上能自动播放直播流(m3u8),隐藏播放器(因为要看互动聊天信息)。

question:

如果用`<video>`标签来拉流的话,是可以播放的,基本上都能播放,但是**不能自动播放**,而且**会全屏**
如果用`<audio>`标签只能兼容部分android版本手机,基本试了市面上的大部分播放器,基本也是这两个问题:
会全屏,不能自动播放,但是其他公司就能达到我们想要的效果,比如:蜻蜓什么的fm平台,就想问问有没有
大神给支个招,怎么解决这个问题啊?

Current solution:

判断已知机型来决定用video还是用audio,但这不是解决办法啊!
求指教
阿神阿神2746 days ago572

reply all(1)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-24 11:39:17

    Video seems to be full screen only in WeChat. You need to add an inline element in the video tag to prevent full screen. It seems like this:

    <video src="" webkit-playsinline playsinline></video>

    As for automatic playback, you need to write a compatibility statement to distinguish between opening in WeChat and opening in a browser. For WeChat, you need to call their jssdk interface. There is no need to fill in the parameters, just add one sentence:

    wx.config({
        debug: false,
        appId: '',
        timestamp:1,
        nonceStr: '',
        signature: '',
        jsApiList: []
    });
    
    wx.ready(function(){
        video.play();
    });

    It seems like this should be enough

    reply
    0
  • Cancelreply