duanjia3187 2016-10-09 22:24
浏览 51

随机化HTML5视频海报图片

I've made a HTML5 video player and I'd like to force the poster image to show up for at least 4 seconds before the video plays. I'd also like to randomize the images that show up.

I've tried to use PHP to look in side the images folder and randomize before image 1 to 3. However, I can't get the image to show up at all and I can't get it to randomize. Can anyone help?

Here is my code:

<div class="vidWrap">

<video autoplay id="movingAlphaVid" style="display: none;"                                                                

preload="auto" poster="/images/image_<?php $random = rand(1,3); echo   $random; ?>.png" >
  • 写回答

1条回答 默认 最新

  • douping6871 2016-10-10 01:56
    关注

    This code will work

    <video autoplay id="movingAlphaVid" 
        controls="controls" src="your_video_file.ext" preload="auto"  
        poster="/images/image_<?php $random = rand(1,3); echo $random; ?>.png" >
    

    Also check the video tag documentation at HTML Video Tag

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog