MediaElement.js - Flash 视频在完全加载之前不会播放 [英] MediaElement.js - Flash Video Wont Play Until Fully Loaded

查看:21
本文介绍了MediaElement.js - Flash 视频在完全加载之前不会播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个问题,MediaElement.js(我的 Flash 视频播放器)在视频完全加载之前不会播放我的 .m4V 视频文件(使用 ffmpeg 编码).

I'm having an issue will MediaElement.js (my flash video player) not playing my .m4V video files (encoded using ffmpeg) until the video is fully loaded.

我已经用各种第三方视频文件对此进行了测试,这些文件在完全加载之前似乎可以立即播放.只有我的文件没有:(

I have tested this with various third party video files that appear to play straight away before they have completely loaded. Only my files do not :(

当使用 html5 视频解决方案播放时,它们会直接播放,而不是使用 Flash 回退.

When played using the html5 video solution they play straight away, just not on the flash fallback.

这可能与视频编码的设置有关吗?我看不出有任何其他原因.

Could this be to do with the settings the video is being encoded at? I don't see any other reason.

代码:

<video id="player1" src='BriefTour.m4v' type="video/mp4" preload="none"></video>

<script>
var videoPlayer = MediaElement('player1',{
  success:function(me){me.play();}              
});
</script>

如您所见,我没有指定任何选项,播放器处于默认设置.

As you can see I am specifying no option, the player is on default settings.

希望有人之前遇到过这个问题并且可以帮助我!

Hope someone has encoutered this before and can help me out!

推荐答案

当您编码自己的视频并使用 FFmpeg 时,我建议使用qt-faststart".

As you are encoding your own videos and using FFmpeg, I suggest using 'qt-faststart'.

这是一个有用的工具,包含在 FFmpeg 中,它重新排列带有 H.264 视频的文件,这样 moov 原子位于数据的前面,从而促进网络流传输".基本上,它允许网络电影在完全下载之前开始播放.

This is a useful tool included with FFmpeg that rearranges a file with H.264 video, "such that the moov atom is in front of the data, thus facilitating network streaming". Basically, it allows web movies to start playing before they are completely downloaded.

使用以下 ffmpeg 目录启用它:

Enable it with the following the ffmpeg directory:

cd ~/ffmpeg
make tools/qt-faststart

用法(在您的 ffmpeg 编码之后):

Usage (after your ffmpeg encoding):

qt-faststart input.foo output.foo

这应该允许您的播放器在视频仍在下载时播放.

This should allow your player to play the video while it is still downloading.

这篇关于MediaElement.js - Flash 视频在完全加载之前不会播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆