开发者

HTML 5 Video tag issue in IOS 4+

I am developing a site targetted to webkit(android and iphone) . Since webkit supports Html 5 video tag so i decided to use this tag to play videos. Due to design issues, I can't show the video place holder on the page. Design demands a play button on the page which is when clicked will start playing video in full screen mode. So I decided to set the width and height of video element to zero to hide the control and use javascript to play the video. Here is my code

<a href="#" onclick="playVideo()">Play Video</a>
<video id="myVideo" src=""></video>
<script type="text/javascript">
function playVideo()
{
                var video = document.getElementById("myVideo");
                try {
                    if (video)
                        video.play();
                    else
                  开发者_如何学Python      alert("video control not found");
                } catch (error) { alert(error); }
}
</script>

.So far so good and it works perfect in android and iphone/ipod prior to IOS 4+ In Iphone 4. Clicking on the link does execute the playVideo function but does not play the video and provide no error.

Can anybody tells me w

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜