Inserting Html5 Video Using Javascript For Ipad
Solution 1:
There is a bug in iPad's webkit that prevents dynamically created video elements from loading properly.
To get around this set the source attribute and call the video elements load method after you have set the html
var html = "";
html += '<video id="someVideo" width="'+settings.width+'" height="'+settings.height+'" controls="controls">';
html += '<source src="'+url+'" type="video/mp4" />';
html += '</video>';
$("#videoDiv").html(html);
$('#someVideo').attr('src', url);
$('#someVideo')[0].load();
Solution 2:
Re ampts answer: please note calling load() on the video element only works if your code is triggered by a user action, like a click handler.
For me this didn't work as apple doesn't seem to think that the history handler (hash change) is a user triggered handler.
For more details see apples documentation on javascript and the video element
Solution 3:
The reason I am planning a JavaScript is that I have few videos on the same page and wanted the user to select a video to be viewed as oppose to a single video on a page... Any idea around that will also help
Place all the videos on the page, each with a style "display: none". Then .show() the appropriate div on the click event.
Post a Comment for "Inserting Html5 Video Using Javascript For Ipad"