1
只有當用戶瀏覽器爲Safari時,我纔想使用html5視頻標籤,如果不是,請使用Flash視頻播放器。僅當瀏覽器爲Safari時才使用html5視頻播放器
下面的代碼不起作用(<!--[if Safari]>
條件是無效的),但它可能給你的就是我要找
<!--[if Safari]>
<video id="player" width="480" controls>
<source src="path/to/movie.mov" />
</video>
<![endif]-->
<!--[if !Safari]>
<script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script type="text/javascript">
var flashvars = {};
var params = {
allowscriptaccess: "true",
file:"path/to/movie.mov"
};
var attributes = {};
swfobject.embedSWF("swf/player.swf", "player", "640", "480", "9.0.0", flashvars, params, attributes);
</script>
<![endif]-->
感謝您的提示!我希望人們在他們的i%Apple%產品(iPhone,iPod,iPad)上觀看電影。我只想在safari中使用視頻標籤的原因是因爲我有許多電影編碼爲.mov文件,並且不想將它們重新編碼爲.ogv文件。 – superUntitled 2011-01-21 19:29:13