Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
588 views
in Technique[技术] by (71.8m points)

javascript - overlay over dynamically inserted video tag in ipad

I'm currently developing a video player with support for ipad.
It's more of a jquery plugin. It works great on desktop and I even managed to add my custom controls on the ipad.
So far so good.
The problem is that I am creating and inserting dynamically the video element, fact that messes up the ipad a bit. I followed this approach because I found out (after a few long hours) that if you try to wrap ($.wrap) the video into a container, the video will crash.
After inserting the video, it acts almost as normal (it is playable and responds to events), but it's position/display properties are messed up: I can't add any overlay on top of it. This is an issue, because I want my controls to be able to be displayed on top of the video.

Moreover, the video itself does not respond to the normal touchmove touchstart touchend events. After some research, it turns out that if you do not have the default controls turned on, the video captures all the events (iPad touch events on <video> tag).
My second problem is that after including the default controls, the video element still seems to ignore my event-handlers.

So, my questions are (both only in Ipad cases):

  • have you ever faced this problem, and of course if you did, how did you fix it?
  • do only hard-coded video elements trigger events?
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...