HTML5 视频加载但无法播放
我正在尝试通过 colorbox 加载 HTML5 文档,该文档播放通过 video 标签添加的视频。视频的链接是:
<a href="content/video/test-video-01.html" class="cboxElement"></a>
添加颜色框的 JS 是:
var $gallery = $( 'a.cboxElement' ).colorbox({
transition : 'elastic',
speed : box_speed,
maxHeight : 700,
maxWidth : 900,
initialHeight : 486,
initialWidth : 722,
fixed : true,
preloading : false,
onCleanup : function() {
$( 'canvas#connector' ).fadeOut( box_speed );
},
onClosed : function() {
box_opened = false;
initiateActivity();
}
} );
$( 'a.cboxElement' ).click( function( e ) {
$gallery.eq(0).click();
return false;
} );
最后,test-video-01.html 看起来像:
<video width="722px" height="487px" controls="controls">
<source src="http://localhost:8888/ipm/content/video/test-video-01.m4v" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
<source src="http://localhost:8888/ipm/content/video/test-video-01.webm" type='video/webm; codecs="vp8, vorbis"' />
Your browser does not support the video tag.
</video>
我已将 AddType 声明添加到我的 .htaccess 文件中以允许不同的 MIME 类型。
问题是这样的,当我通过 Colorbox 加载内容时,它显示电影和控件;然而,这部电影不会播放。我可以单击电影时间轴并查看电影的不同帧,但它永远不会播放。当我直接访问 test-video-o1.html 文件时,它工作得很好。 Colorbox 发出 AJAX 请求来获取 HTML 文件,我想知道这是否会导致问题。对此的任何帮助都会很棒。谢谢!
I am attempting to load an HTML5 document via colorbox that plays an video that is added via the video tag. The link to the video is:
<a href="content/video/test-video-01.html" class="cboxElement"></a>
The JS to add the colorbox is:
var $gallery = $( 'a.cboxElement' ).colorbox({
transition : 'elastic',
speed : box_speed,
maxHeight : 700,
maxWidth : 900,
initialHeight : 486,
initialWidth : 722,
fixed : true,
preloading : false,
onCleanup : function() {
$( 'canvas#connector' ).fadeOut( box_speed );
},
onClosed : function() {
box_opened = false;
initiateActivity();
}
} );
$( 'a.cboxElement' ).click( function( e ) {
$gallery.eq(0).click();
return false;
} );
And finally, test-video-01.html looks like:
<video width="722px" height="487px" controls="controls">
<source src="http://localhost:8888/ipm/content/video/test-video-01.m4v" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
<source src="http://localhost:8888/ipm/content/video/test-video-01.webm" type='video/webm; codecs="vp8, vorbis"' />
Your browser does not support the video tag.
</video>
I have added the AddType declarations to my .htaccess file to allow the different MIME types.
The problem is this, when I load the content via Colorbox, it shows the movie and the controls; however, the movie will not play. I can click on the movie timeline and see different frames of the movie, but at no point will it play. When I visit the test-video-o1.html file directly it works perfectly. Colorbox makes an AJAX request to get the HTML file and I'm wondering if this does something to cause the problem. Any help with this would be awesome. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
抱歉作为答案发布,因为这对于评论来说太大了。
你有机会发布 jsfiddle 吗?
我想到了一些事情:
moovatom/优化流媒体启用?
响应..通常会导致问题)
事件查看是否记录。
Sorry posted as an answer as this was too big for a comment.
Is there any chance you can post a jsfiddle?
A few things off the top of my head:
moov atom / optimised for streaming enabled?
response.. often causes probs)
event see if it logs.