0

我正在使用一个 HTML5 和 jQuery 交互式视频库以及我从教程改编的 Flash 后备。该网站是流动的。我不知道 jQuery,我正在尝试让小型移动设备播放比当前提供的 (800x450) 更小的尺寸 (480x272) 的视频。

这是我更改代码的方式,但无法识别媒体查询。我的格式错误是什么?

var videoCode = '<video width="'+480+'" height="'+272+'" controls autoplay autobuffer>
                 <source src="video/'+videoFile+'_small.ogv" type="video/ogg" media="screen and (max-width:500px)">
                 <source src="video/'+videoFile+'_small.mp4" type="video/mp4" media="screen and (max-width:500px)">
                 <video width="'+800+'" height="'+450+'" controls autoplay autobuffer>
                 <source src="video/'+videoFile+'.ogv" type="video/ogg" />
                 <source src="video/'+videoFile+'.mp4" type="video/mp4" />

编辑:固定编码布局

4

2 回答 2

0

您的代码似乎丢失了,但添加/更新元素的属性是$('someselector').attr('attrname', 'value');

于 2012-04-26T15:27:32.757 回答
0
//var videoFile = $(this).attr('videofile');
    var videoFile = (screen.width < 500) ? $(this).attr('videofile') + "_small" : $(this).attr('videofile');
    var videoPoster = $(this).attr('videofile');
    var videoPoster = $(this).attr('videofile');
    var videoWidth = (screen.width < 500) ? 200 : 800;
    var videoHeight = (screen.height < 500) ? 200 : 450;

这被证明是解决方案。

于 2012-05-11T14:09:14.807 回答