Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 video: possible to place regular html content over video

Just wondering if anyone knows any tricks to getting regular html content (mainly an img tag) to display on top of a video (via the video tag)?

like image 405
Jason Miesionczek Avatar asked Jan 07 '11 14:01

Jason Miesionczek


People also ask

Which video format is suitable for HTML5 video?

The HTML5 video format capabilities include three options to play: MP4, WebM, and Ogg.

Which video formats is not allowed by HTML?

wmv" video files are not supported by any browser. That is the only way for WMV video files.

Which of the following is true about video in HTML5?

Q 4 - Which of the following is true about 'video' tag in HTML5? A - HTML5 supports <video> tag which is used to embed a video file in an HTML or XHTML document.


2 Answers

As others have intimated it's very easy to position HTML elements on top of VIDEO elements using absolute positioning. The challenge comes when you try to capture events on them in the iPhone, iPod and possibly older Android phones that don't play video assets inline on the page (as opposed to in a thin native playback client) since in those instances the VIDEO element greedily captures events.

If you use an IMAGE element or a DIV with its background-image set to an image you want to use as a "poster" or "thumbnail" then your users won't be able to tap on them to get the video to start playing -- the mobile browser will treat this behavior as if nothing but the VIDEO element exists in that space (good if you happen to click in the middle where the "big play" button is but not so helpful if you, say, have a custom control not in the middle.

The solution I've used in the past is to just put the IMG or DIV poster on the page where you would normally put the VIDEO element and shift the VIDEO element offscreen (absolutely positioned with left style set to, say, -3000px) so it can no longer hoard those events.

I know this isn't exactly what was asked, but hopefully this information will prove useful to someone.

like image 198
natlee75 Avatar answered Oct 13 '22 01:10

natlee75


You can simply put html elements on top of HTML5 video by positioning them absolutly on top of the video. Give both the video element and the HTML element a "position:absolute" and put the HTML element a z-index higher than the video element's.

like image 40
jj1910 Avatar answered Oct 13 '22 00:10

jj1910