【问题标题】:How to create a custom frame for Youtube embedded player?如何为 Youtube 嵌入式播放器创建自定义框架?
【发布时间】:2013-11-27 18:06:47
【问题描述】:

我正在开发一个网站,我想在其中显示来自 youtube 的视频(使用 YT 提供的嵌入式播放器)修改播放器外部的框架。

更具体地说,我想创建一个电视图像,而不是电视屏幕,我想在其中显示我的视频。

我试图从取消屏幕的 photoshop 创建一张照片,但是在 HTML 中,如果我选择该 img 作为 background-div 照片或将其插入为 ,使用 z-indexes ,我无法点击视频的“播放”按钮,因为它被“电视”div 覆盖。 有什么帮助吗??

【问题讨论】:

    标签: html css youtube-api youtube-data-api


    【解决方案1】:

    您可以将图像分割成顶部/左侧/右侧/底部部分,并将它们放置在 youtube 视频周围(覆盖 youtube 播放器的边缘)

    I've mocked up a jsfiddle that uses background-color instead of the sliced up images.

    HTML:

    <div id="TV">
        <div id="top"></div>
        <div id="left"></div>
        <div id="right"></div>
        <div id="bottom"></div>
        <div id="playButton">play<div>
    </div>
    

    CSS:

    #TV{position:absolute;width:500px;height:300px;}
    #top{position:absolute;top:0;width:500px;height:20px;background-color:red;}
    #left{position:absolute;top:0;left:0;width:20px;height:300px;background-color:red;}
    #right{position:absolute;top:0;right:0;width:20px;height:300px;background-color:red;}
    #bottom{position:absolute;bottom:0;width:500px;height:20px;background-color:red;}
    #playButton{height:100px;width:100px;border-radius:100px;background-color:yellow;left: 200px;position: absolute;top: 90px;}
    #playButton:hover{background-color:red;}
    

    我也有一个这样的例子,你可以在画布上画在“框架”图像的中间。 Here

    唯一需要注意的是,您需要使用固定的高度和宽度以及绝对位置。

    【讨论】:

      【解决方案2】:

      这是一个代码html,你可以插入一个YT视频

       &lt;iframe src="https://www.youtube.com/embed/5L3wKniOnro?autoplay=1" width="600" height="400" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-09-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-12-03
        相关资源
        最近更新 更多