在全屏视频上放置文字(HTML5)

Yav*_*lim 6 html javascript css video css3

我想在全屏视频上放置HTML格式的文字.

我可以让它不全屏,但它不能全屏工作.

有什么办法吗?

position:absoulute用于文本和position:relative/fixed/none视频.

另外我不知道它是否有效,但我不熟悉.requestFullscreen();浏览器的功能,我无法调整视频大小.

如果.requestFullscreen();有效.我需要调整视频大小.

视频标签的宽度和高度正在发生变化,但视频不会发生变化.

Rac*_*len 3

您可以使用带有 iframe 的 Youtube 和 vimeo 以及带有对象嵌入的 Viddler 和 Blip.tv 进行响应式嵌入。这里有一篇文章对此进行了解释,代码可以在github上找到

YouTube 的示例代码(使用 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();
Run Code Online (Sandbox Code Playgroud)