overlay over dynamically inserted video tag in ipad

孤者浪人 提交于 2019-11-29 05:19:33
gion_13

After some more digging I've found the answer.
Looks like the unmarked answer in this stackoverflow question holds the key.
So, as Jaffa The Cake (who I ow a bucket of thanks) sais : "You can fix z-index on dynamically created videos by giving the video element -webkit-transform-style: preserve-3d", the only workaround is to use the css3 property -webkit-transform-style: preserve-3d.
This way, one can put an overlay on top of the video which can handle all the events (such as play/pause).

No Ipad can handle dynamic inserted video by Jquery, on the Ipad videos do not respond to touch or move as by default you have to click on a link like play button to trigger the video audio so you can just use Jquery to do this like below

video

var vid = $('video').get(0);

$('#someselector').click(function() {
 vid.play();

 });
$('#someselector').click(function() {
 vid.stop();

 });

audio

var aud = $('audio').get(0);

$('#someselector').click(function() {
 aud.play();

 });
$('#someselector').click(function() {
 aud.stop();

 });

Hope this helped.

The solution for me was to remove the controls using jQuery for all videos like this

$('video').each(function() {
    $(this).removeAttr("controls");
});

Then, the overlay elements also respond to the corresponding events. To make the video working again, I've added jquery click event that plays/pause the video:

$('video').click(function() {
    $(this).trigger('play');
});

Hope that helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!