在VG视频中嵌入Vimeo视频

时间:2016-04-26 18:59:56

标签: html image video vimeo

我正在尝试在iPhone的PNG图像中播放某个视频。 iPhone正在作为视频的框架。我能够使用这个CSS代码实现这个目标:

        #phone_container {
          width: 343px;
          /* Adjust Phone image width */
          height: 663px;
          /* Adjust Phone image height */
          position: relative;
        }

        #phone_container:after {
          content: '';
          display: block;
          background: url('iphone png link') no-repeat top left transparent;
          width: 100%;
          height: 100%;
          left: 0px;
          top: 0px;
          position: absolute;
          z-index: 10;
        }
        #video-placeholder {
          position: absolute;
          top: 125px;
          /* Adjust top position */
          left: 55px;
          /* Adjust left position */
          z-index: 5;
        }

我还能够使用此HTML代码实现此目的:

        <div class="row demo-video">
          <div class="col-md-5 left-side" id="phone_container">
            <div>
              <iframe id="video-placeholder" src="Video Link" width="270" height="464" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
            </div>
          </div>

虽然它工作得非常好,唯一的问题是因为z-index的{​​{1}}小于图像。 Vimeo播放器控件不起作用。我尝试将播放器控件的iframe设置为高于iPhone的值,但它仍然无法正常工作。它也没有响应。我该如何解决这个问题?有什么建议吗?

1 个答案:

答案 0 :(得分:0)

创建div元素并在CSS中设置其widthheight属性。然后为该div应用background-image。然后,您可以尝试将vimeo视频嵌入div

<div class="vimeo-video">
<!-- vimeo embed link with appropriate width and height //-->
</div> 

像这样添加CSS:

.vimeo-video {
    background-image: url('link-to-png.png');
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    padding-top: /* play around with this to fit the video */;
    padding-bottom: /* play around with this to fit the video */;
    padding-left: /* play around with this to fit the video */;
    padding-right: /* play around with this to fit the video */;
}

padding值保留为百分比以启用响应式设计。