Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put a text on fullscreen video (HTML5)

I want to put text on fullscreen video at HTML.

I could make it non fullscreen but it is not working on fullscreen.

Is there any way to do it?

I use position:absoulute for text and position:relative/fixed/none for video.

Also I don't know if it works but I called .requestFullscreen(); function for browser unhappily I cannot resize video.

If .requestFullscreen(); is works. I need to resize video.

width and height of video tags is changing but video is not changing.

like image 488
Yavuz Selim Avatar asked Jul 24 '15 14:07

Yavuz Selim


People also ask

How do I force HTML full screen?

Full-screen can be activated for the whole browser window by pressing the F11 key. It can be exited by pressing the Esc button.

How do I make a div visible on top of an html5 fullscreen video?

It's a simple trick, you need to add the maximum value of z-index which is (z-index: 2147483647;) in to the overlay element. That trick will solve your issue.


1 Answers

You can embed responsively with Youtube and vimeo with iframes, and with Viddler and Blip.tv with object embed. There is an article that explains it here and code is available on github

Sample code for Youtube (using jquery):

// Find all YouTube videos
var $allVideos = $("iframe[src^='//www.youtube.com']"),

    // The element that is fluid width
    $fluidEl = $("body");

// Figure out and save aspect ratio for each video
$allVideos.each(function() {

  $(this)
    .data('aspectRatio', this.height / this.width)

    // and remove the hard coded width/height
    .removeAttr('height')
    .removeAttr('width');

});

// When the window is resized
$(window).resize(function() {

  var newWidth = $fluidEl.width();

  // Resize all videos according to their own aspect ratio
  $allVideos.each(function() {

    var $el = $(this);
    $el
      .width(newWidth)
      .height(newWidth * $el.data('aspectRatio'));

  });

// Kick off one resize to fix all videos on page load
}).resize();
like image 136
Rachel Gallen Avatar answered Oct 06 '22 00:10

Rachel Gallen