android - 使用 mediaelement 在 Android 上流式传输 hls

标签 android streaming mediaelement.js

我正在尝试使用 mediaelement.js UI 在 iPad、iPhone 和 Android 中传输 hls。

html 类似如下(对不起,我无法公开我们的 hls 链接):

<video src="testinghls.m3u8"></video>

脚本:

$('video').mediaelementplayer({
      // if the <video width> is not specified, this is the default
      defaultVideoWidth: 480,
      // if the <video height> is not specified, this is the default
      defaultVideoHeight: 270,
      // specify to force MediaElement to use a particular video or audio type
      type: 'application/x-mpegURL',
      // the order of controls you want on the control bar (and other plugins below)
      features: ['playpause','progress','volume','fullscreen'],
      // Hide controls when playing and mouse is not over the video
      alwaysShowControls: false,
      // force iPad's native controls
      iPadUseNativeControls: false,
      // force iPhone's native controls
      iPhoneUseNativeControls: false,
      // force Android's native controls
      AndroidUseNativeControls: false
    });

这在 iPad 和 iPhone 上运行良好,但在 Android 上失败。它只是以某种方式检测到视频无法播放并退回到下载链接。

除了我已经尝试过使用 hls 的纯视频标签之外,无论有或没有 iOS 和 Android 设备中的类型,它都可以正常工作,如下所示:

<video src="{{c.get('hls')}}" type="application/x-mpegURL" style="width:320px;height:185px" controls></video>
<video src="{{c.get('hls')}}" style="width:320px;height:185px" controls></video>

我应该如何配置 Mediaelement 才能使其正常工作?或者也许使用 Mediaelement.js 进行一些调整/修改?

最佳答案

这可能是视频编码问题。 Android 需要某种编码,这是 MediaElement.js 中的一个值得注意的问题

this 中建议了解决方案

关于android - 使用 mediaelement 在 Android 上流式传输 hls,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13718678/

相关文章:

Java - 通过 switch case 函数设置颜色

c# - VLC Media Player 如何实现 HTTP Streaming?

javascript - MediaElementJs 结束回调未触发

javascript - 在 Rails 中播放上传的音乐

android - 适配器的 getposition() 未在 Android 中调用

Android Studio 0.4.3 - 无法编译官方 Android 示例

android - 添加 Google Play 服务后在 Unity Android 项目中出现 multidesx 问题

ruby-on-rails - Heroku:在没有本地文件系统的情况下为大型动态生成的 Assets 提供服务

javascript - mediaelement 'playing' 事件跟踪