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 使用ESP8266连接阿里云出现问题
  • ¥15 被蓝屏搞吐了,有偿求帮解答,Ai回复直接拉黑
  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并