lecteur de vidéo

Répondre
Suta
Suta
Déconnecté
Bonjour !

Je ne connais pas grand chose au js, et j'aimerai faire une "sorte" de lecteur video.

Pour cela j'ai plusieurs video sur le site http://dailymotion.com
Pour ceux qui ne connaissent pas le fonctionnement : j'ai uploader mes video sur leur site puis eux me donne un tag à inserer dans mon code source de la forme : <div><object>...</objet></div>

j'aimerai mettre une liste des video (sous forme de liens) et un cadre ou se jouera la video selectionnée (dans la liste des liens donc).

je pourrai le faire en php mais la page se recharge a chaque fois et j'aimerai bien qu'il n'y ai pas de rechargement...

est ce possible ? pouvez vous m'aider ou me mettre sur la voie (tuto etc...)?

Merci d'avance !
i M@N
i M@N
Déconnecté
One Love, One Heart, One Unity.
Hello !

Tu mets seulement le code qui se trouve entre les balises <object> et </object> et ça fonctionne.
  1. <object width="425" height="335">
  2. <param name="movie" value="http://www.dailymotion.com/swf/2WFMnXNyCg3SF26kn">
  3. </param>
  4. <embed src="http://www.dailymotion.com/swf/2WFMnXNyCg3SF26kn" type="application/x-shockwave-flash" width="425" height="334">
  5. </embed>
  6. </object> 


Après pour faire ça en JavaScript je sais pas trop, mais ça doit pas être très dur de trouver un script qui change juste le lien de la vidéo ... google est ton ami. smiley

@+...
i M@N
i M@N
Déconnecté
One Love, One Heart, One Unity.
Reuh ...

Bon j'avais 5 minutes alors voilà une soluce ...
fichier avec les liens vers les vidéos :
  1. <html>
  2. <head>
  3. <script>
  4. var dragapproved=false
  5. var minrestore=0
  6. var initialwidth,initialheight
  7. var ie5=document.all&&document.getElementById
  8. var ns6=document.getElementById&&!document.all
  9.  
  10. function iecompattest(){
  11. return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
  12. }
  13.  
  14. function drag_drop(e){
  15. if (ie5&&dragapproved&&event.button==1){ 
  16. document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx+"px"
  17. document.getElementById("dwindow").style.top=tempy+event.clientY-offsety+"px"
  18. }
  19. else if (ns6&&dragapproved){
  20. document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx+"px"
  21. document.getElementById("dwindow").style.top=tempy+e.clientY-offsety+"px"
  22. }
  23. }
  24.  
  25. function initializedrag(e){
  26. offsetx=ie5? event.clientX : e.clientX
  27. offsety=ie5? event.clientY : e.clientY
  28. document.getElementById("dwindowcontent").style.display="none" //extra
  29. tempx=parseInt(document.getElementById("dwindow").style.left)
  30. tempy=parseInt(document.getElementById("dwindow").style.top)
  31.  
  32. dragapproved=true
  33. document.getElementById("dwindow").onmousemove=drag_drop
  34. }
  35.  
  36. function loadwindow(url,width,height){
  37. if (!ie5&&!ns6)
  38. window.open(url,"","width=width,height=height,scrollbars=1")
  39. else{
  40. document.getElementById("dwindow").style.display=''
  41. document.getElementById("dwindow").style.width=initialwidth=width+"px"
  42. document.getElementById("dwindow").style.height=initialheight=height+"px"
  43. document.getElementById("dwindow").style.left="30px"
  44. document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"
  45. document.getElementById("cframe").src=url
  46. }
  47. }
  48.  
  49. function maximize(){
  50. if (minrestore==0){
  51. minrestore=1 //maximize window
  52. document.getElementById("maxname").setAttribute("src","restore.gif")
  53. document.getElementById("dwindow").style.width=ns6? window.innerWidth-20+"px" : iecompattest().clientWidth+"px"
  54. document.getElementById("dwindow").style.height=ns6? window.innerHeight-20+"px" : iecompattest().clientHeight+"px"
  55. }
  56. else{
  57. minrestore=0 //restore window
  58. document.getElementById("maxname").setAttribute("src","max.gif")
  59. document.getElementById("dwindow").style.width=initialwidth
  60. document.getElementById("dwindow").style.height=initialheight
  61. }
  62. document.getElementById("dwindow").style.left=ns6? window.pageXOffset+"px" : iecompattest().scrollLeft+"px"
  63. document.getElementById("dwindow").style.top=ns6? window.pageYOffset+"px" : iecompattest().scrollTop+"px"
  64. }
  65.  
  66. function closeit(){
  67. document.getElementById("dwindow").style.display="none"
  68. }
  69.  
  70. function stopdrag(){
  71. dragapproved=false;
  72. document.getElementById("dwindow").onmousemove=null;
  73. document.getElementById("dwindowcontent").style.display="" //extra
  74. }
  75. </script>
  76. </head>
  77. <body>
  78. <divid="dwindow" style="position:absolute;background-color:#EBEBEB;cursor:hand;left:0px;top:0px;display:none" onMousedown="initializedrag(event)" onMouseup="stopdrag()" onSelectStart="return false">
  79. <div align="right" style="background-color:navy"><img src="max.gif" id="maxname" onClick="maximize()"><img src="close.gif" onClick="closeit()"></div>
  80. <div id="dwindowcontent" style="height:100%">
  81. <iframe id="cframe" src="" width=100% height=100%></iframe>
  82. </div>
  83. </div>
  84.  
  85. <!--Use below code to load DHTML window via link-->
  86. <a href="javascript:loadwindow('http://www.google.com',600,400)">Google</a>
  87.  
  88. <a href="javascript:loadwindow('./video.php?video=2WFMnXNyCg3SF26kn',500,400)">video 1</a>
  89.  
  90. <a href="javascript:loadwindow('./video.php?video=3O1vMAAjA37Qt29QC',500,400)">video 2</a>
  91. </body>
  92. </html>
  93.  

fichier video.php qui va afficher les vidéo dans une fenêtre à l'intérieur de ta page :
  1. <?php
  2. if (isset($_GET['video'])) $video = ereg_replace('<[":]>','',$_GET["video"]); else $video = "2WFMnXNyCg3SF26kn";  
  3. ?>
  4. <html>
  5. <head>
  6. </head>
  7. <body>
  8. <object width="425" height="335">
  9. <param name="movie" value="http://www.dailymotion.com/swf/<?php echo $video; ?>">
  10. </param>
  11. <embed src="http://www.dailymotion.com/swf/<?php echo $video; ?>" type="application/x-shockwave-flash" width="425" height="334">
  12. </embed>
  13. </object>
  14. </body>
  15. </html> 


Je me suis servi de ça :
http://dynamicdrive.com/dynamicindex8/dhtmlwindow.htm
T'auras aussi besoin des images suivantes :
http://dynamicdrive.com/dynamicindex8/close.gif
http://dynamicdrive.com/dynamicindex8/restore.gif
http://dynamicdrive.com/dynamicindex8/max.gif

@+...
Suta
Suta
Déconnecté
OUaou merci beaucoup I M@N je m'attendais pas a tout ça !

Bon et bien je vais mettre tout ça en place, merci encore !
Répondre
Accès rapide :

Remonter Remonter
L'éditeur javascript - CSS - Gentoo - Tutoriaux PHP - Tutoriels PHP - Breizh Blog