[HTML PHP] Insérer une vidéo aléatoirement
Résolu
maxmar
-
maxime31 Messages postés 48 Date d'inscription Statut Membre Dernière intervention -
maxime31 Messages postés 48 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
Je cherche a afficher une vidéo de façon aléatoire parmis une série de vidéos pré sélectionnées, dans une page HMTL.
J'ai essayé avec un script PHP, mais je n'y arrive pas.
Je vous montre ce que j'ai fait, pouvez vous m'aider (je cherche a afficher la vidéo dans un calque), mais je ne parviens pas a trouver ce que je dois mettre dans le calque comme code pour que ca fonctionne...
<body>
<?php
$nbvideo=3;
$nomvideo[1]="<object width="320" height="256"><param name="movie" value="https://www.dailymotion.com/embed/video/xddw53?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed type="application/x-shockwave-flash" src="https://www.dailymotion.com/embed/video/xddw53?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B" width="320" height="256" allowfullscreen="true" allowscriptaccess="always"></embed></object>";
$nomvideo[2]="<object width="320" height="179"><param name="movie" value="https://www.dailymotion.com/embed/video/xd76r0?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed type="application/x-shockwave-flash" src="https://www.dailymotion.com/embed/video/xd76r0?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B" width="320" height="179" allowfullscreen="true" allowscriptaccess="always"></embed></object>";
$nomvideo[3]="<object width="320" height="240"><param name="movie" value="https://www.dailymotion.com/embed/video/xd4wiy?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed type="application/x-shockwave-flash" src="https://www.dailymotion.com/embed/video/xd4wiy?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B" width="320" height="240" allowfullscreen="true" allowscriptaccess="always"></embed></object>"
srand((double)microtime()*1000000);
$affvideo=rand(1,$nbvideo);
?>
<div id="Layer1" style="position:absolute; width:613px; height:302px; z-index:1; left: 9px; top: 75px;"> </div>
</body>
Merci d'avance
Je cherche a afficher une vidéo de façon aléatoire parmis une série de vidéos pré sélectionnées, dans une page HMTL.
J'ai essayé avec un script PHP, mais je n'y arrive pas.
Je vous montre ce que j'ai fait, pouvez vous m'aider (je cherche a afficher la vidéo dans un calque), mais je ne parviens pas a trouver ce que je dois mettre dans le calque comme code pour que ca fonctionne...
<body>
<?php
$nbvideo=3;
$nomvideo[1]="<object width="320" height="256"><param name="movie" value="https://www.dailymotion.com/embed/video/xddw53?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed type="application/x-shockwave-flash" src="https://www.dailymotion.com/embed/video/xddw53?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B" width="320" height="256" allowfullscreen="true" allowscriptaccess="always"></embed></object>";
$nomvideo[2]="<object width="320" height="179"><param name="movie" value="https://www.dailymotion.com/embed/video/xd76r0?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed type="application/x-shockwave-flash" src="https://www.dailymotion.com/embed/video/xd76r0?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B" width="320" height="179" allowfullscreen="true" allowscriptaccess="always"></embed></object>";
$nomvideo[3]="<object width="320" height="240"><param name="movie" value="https://www.dailymotion.com/embed/video/xd4wiy?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed type="application/x-shockwave-flash" src="https://www.dailymotion.com/embed/video/xd4wiy?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B" width="320" height="240" allowfullscreen="true" allowscriptaccess="always"></embed></object>"
srand((double)microtime()*1000000);
$affvideo=rand(1,$nbvideo);
?>
<div id="Layer1" style="position:absolute; width:613px; height:302px; z-index:1; left: 9px; top: 75px;"> </div>
</body>
Merci d'avance
A voir également:
- [HTML PHP] Insérer une vidéo aléatoirement
- Insérer une vidéo dans powerpoint - Guide
- Montage video windows - Guide
- Comment télécharger une vidéo youtube - Guide
- Nommez une application d'appel vidéo ou de visioconférence - Guide
- Insérer signature word - Guide
4 réponses
Tu devrais plutôt essayer avec Javascript
Le PHP est utilisé principalement côté serveur alors que là c'est dans la page et il faut un script côté client : le Javascipt
Le PHP est utilisé principalement côté serveur alors que là c'est dans la page et il faut un script côté client : le Javascipt
https://apprendre-php.com/tutoriels/tutoriel-1-rotation-de-bannieres-publicitaires-a-affichage-aleatoire.html
Prend exemple sur ce script, c'est le même principe.
Tiens-nous au courant si cela marche ou pas.
Prend exemple sur ce script, c'est le même principe.
Tiens-nous au courant si cela marche ou pas.