Lecture d'un son en php ou javascript ?

Noel-barbu Messages postés 305 Statut Membre -  
loupix57 Messages postés 316 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

J'aimerais faire jouer un son mp3, wma ou wav quand je passe la souris sur un lien internet

Du style :

<a href="" target="_parent" >Suivant</a>

comment puis-je faire ?

2 réponses

  1. loupix57 Messages postés 316 Date d'inscription   Statut Membre Dernière intervention   14
     
    Salut !
    Tu peut utiliser la balise <audio > en HTML5 !
    plus d'info par la : https://developer.mozilla.org/fr/docs/Web/HTML/Element/audio
    0
    1. Noel-barbu Messages postés 305 Statut Membre 2
       
      il faudrait que cela fonctionne au passage de la souris quand je vais sur le lien....
      0
    2. loupix57 Messages postés 316 Date d'inscription   Statut Membre Dernière intervention   14
       
      avec l'attribut onmousemove="return getElementById("ma_balise_audio").play();"
      0
    3. Noel-barbu Messages postés 305 Statut Membre 2
       
      <a href="" target="_parent" onmousemove="return getElementById("ma_balise_audio").play();">Suivant</a> 

      Un truc comme ça et coter JavaScript comment dois-je procédé ?
      0
  2. Noel-barbu Messages postés 305 Statut Membre 2
     
    Ensuite j'ai encore un autre souci je n'arrive pas a télécharger mon .rar voilà mon code :

    <?php
    $telechargement=$_GET['RAR'];
    switch ($telechargement){
    case 'IRC':
    echo header('Content-type:application/rar');
    echo header('Pragma: no-cache');
    echo header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
    echo header('Expires: 0');
    echo header('Content-Disposition: attachment; filename=Téléchargement_de_IRC.rar');
    echo readfile('../XChat.rar');
    echo exit();
    break;
    default :
    echo header('Location: ../assistance.aspx');
    break;
    }
    ?>

    et voici le lien de de ma page html qui permet de télécharger le fichier :

    <a href="telechargement.php?RAR=IRC"> IRC </a>


    le problème est que cela fonctionne mais quand j'ouvre directement le rar celui-ci n'arrive pas a extraire.

    regarder :
    0
    1. loupix57 Messages postés 316 Date d'inscription   Statut Membre Dernière intervention   14
       
      essaye de mettre comme header :

      $file = '../XChat.rar';
      $name = 'Téléchargement_de_IRC.rar';

      header("Content-Type: application/force-download; charset=UTF-8");
      header("Content-Transfer-Encoding:application/rar \n"); // Surtout ne pas enlever le \n
      header("Content-Length: ".filesize($file));
      header('Content-Disposition: attachment; filename="'.$name.'"');
      readfile($file);
      0
    2. Noel-barbu Messages postés 305 Statut Membre 2
       
      j'ai enfin de compte réussi grâce a toi Loupix pour le téléchargement du fichier donc voici comment j'ai procédé pour mes besoin personnelle, mon code source peut être que ça pourra en aider plus d'un.


      <?php

      $telechargement_fichier=$_GET['fichier'];
      switch ($telechargement_fichier){

      case 'RAR':
      $fichier = '../programme/encryption.rar';
      switch(strrchr(basename($fichier), '.'))
      {
      case '.gz': $type = 'application/x-gzip'; break;
      case '.tgz': $type = 'application/x-gzip'; break;
      case '.zip': $type = 'application/zip'; break;
      case '.pdf': $type = 'application/pdf'; break;
      case '.png': $type = 'image/png'; break;
      case '.gif': $type = 'image/gif'; break;
      case '.jpg': $type = 'image/jpeg'; break;
      case '.txt': $type = 'text/plain'; break;
      case '.htm': $type = 'text/html'; break;
      case '.html': $type = 'text/html'; break;
      }
      header('Content-Type: application/force-download');
      header('Content-Transfer-Encoding: $type\n');
      header('Content-Length: '.filesize($fichier));
      header('Content-Disposition: attachment; filename=telechargment_de_encryption.rar');
      header('Pragma: no-cache');
      header('Cache-Control: must-revalidate, post-check=0, pre-check=0, public');
      header('Expires: 0');
      readfile($fichier);
      exit();
      break;


      case 'RAR2':
      $fichier2 = '../programme/decompileur.rar';
      switch(strrchr(basename($fichier2), '.'))
      {
      case '.gz': $type = 'application/x-gzip'; break;
      case '.tgz': $type = 'application/x-gzip'; break;
      case '.zip': $type = 'application/zip'; break;
      case '.pdf': $type = 'application/pdf'; break;
      case '.png': $type = 'image/png'; break;
      case '.gif': $type = 'image/gif'; break;
      case '.jpg': $type = 'image/jpeg'; break;
      case '.txt': $type = 'text/plain'; break;
      case '.htm': $type = 'text/html'; break;
      case '.html': $type = 'text/html'; break;
      }
      echo header('Content-Type: application/force-download');
      echo header('Content-Transfer-Encoding: $type\n');
      echo header('Content-Length: '.filesize($fichier2));
      echo header('Content-Disposition: attachment; filename=telechargment_decompileur.rar');
      echo header('Pragma: no-cache');
      echo header('Cache-Control: must-revalidate, post-check=0, pre-check=0, public');
      echo header('Expires: 0');
      echo readfile($fichier2);
      exit();
      break;

      default :
      echo header('Location: ../assistance.aspx');
      break;
      }

      ?>

      voilou !

      me reste à régler le souci de l'audio sur le bouton et c'est bon.
      0
    3. loupix57 Messages postés 316 Date d'inscription   Statut Membre Dernière intervention   14
       
      Super !
      J'suis content que ça ai marcher !
      Et tien, si tu connais quelqu'un qui aurais besoin d'un site internet , envois moi un mail ;-)
      0