Guest User

Untitled

a guest
Sep 23rd, 2015
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.80 KB | None | 0 0
  1. <?php include('../membre/include/head.php'); ?>
  2. <?php include('../include/menu.php'); ?>
  3. <div class="container">
  4. <!-- Formulaire -->
  5. <form method="post" action="creation_murmur.php">
  6. <hr>
  7. <div class="row">
  8. <div class="col-lg-6">
  9. <label for="nom">Nom de la demande :</label>
  10. <input class="form-control" type="text" id="nom" name="nom">
  11. </div>
  12. </div><br>
  13. <div class="row">
  14. <div class="col-lg-6">
  15. <label for="description">Description du titre recherché :</label>
  16. <textarea class="form-control" rows="5" id="description" name="description"></textarea>
  17. </div>
  18. </div><br>
  19. <hr>
  20. <button class="btn btn-large btn-primary" onclick="startRecording(this);">Enregistrer</button>
  21. <button class="btn btn-large btn-primary" onclick="stopRecording(this);" disabled>Arreter l'enregistrement</button>
  22.  
  23. <h2>Votre enregistrement :</h2>
  24. <ul id="recordingslist"></ul>
  25.  
  26. <h2>Log</h2>
  27. <pre id="log"></pre>
  28.  
  29. <script>
  30. function __log(e, data) {
  31. log.innerHTML += "\n" + e + " " + (data || '');
  32. }
  33.  
  34. var audio_context;
  35. var recorder;
  36.  
  37. function startUserMedia(stream) {
  38. var input = audio_context.createMediaStreamSource(stream);
  39. __log('Media stream created.' );
  40. __log("input sample rate " +input.context.sampleRate);
  41.  
  42. input.connect(audio_context.destination);
  43. __log('Input connected to audio context destination.');
  44.  
  45. recorder = new Recorder(input);
  46. __log('Recorder initialised.');
  47. }
  48.  
  49. function startRecording(button) {
  50. recorder && recorder.record();
  51. button.disabled = true;
  52. button.nextElementSibling.disabled = false;
  53. __log('Recording...');
  54. }
  55.  
  56. function stopRecording(button) {
  57. recorder && recorder.stop();
  58. button.disabled = true;
  59. button.previousElementSibling.disabled = false;
  60. __log('Stopped recording.');
  61.  
  62. // create WAV download link using audio data blob
  63. createDownloadLink();
  64.  
  65. recorder.clear();
  66. }
  67.  
  68. function createDownloadLink() {
  69. recorder && recorder.exportWAV(function(blob) {
  70. /*var url = URL.createObjectURL(blob);
  71. var li = document.createElement('li');
  72. var au = document.createElement('audio');
  73. var hf = document.createElement('a');
  74.  
  75. au.controls = true;
  76. au.src = url;
  77. hf.href = url;
  78. hf.download = new Date().toISOString() + '.wav';
  79. hf.innerHTML = hf.download;
  80. li.appendChild(au);
  81. li.appendChild(hf);
  82. recordingslist.appendChild(li);*/
  83. });
  84. }
  85.  
  86. window.onload = function init() {
  87. try {
  88. // webkit shim
  89. window.AudioContext = window.AudioContext || window.webkitAudioContext;
  90. navigator.getUserMedia = ( navigator.getUserMedia ||
  91. navigator.webkitGetUserMedia ||
  92. navigator.mozGetUserMedia ||
  93. navigator.msGetUserMedia);
  94. window.URL = window.URL || window.webkitURL;
  95.  
  96. audio_context = new AudioContext;
  97. __log('Audio context set up.');
  98. __log('navigator.getUserMedia ' + (navigator.getUserMedia ? 'available.' : 'not present!'));
  99. } catch (e) {
  100. alert('No web audio support in this browser!');
  101. }
  102.  
  103. navigator.getUserMedia({audio: true}, startUserMedia, function(e) {
  104. __log('No live audio input: ' + e);
  105. });
  106. };
  107. </script>
  108.  
  109. <script src="recordmp3.js"></script>
  110. <div class="row">
  111. <button class="btn btn-large btn-success" type="submit">Envoyer</button>
  112. </div>
  113. </form>
  114. </div> <!-- /container -->
  115. <?php include('../include/footer.php') ?>
Advertisement
Add Comment
Please, Sign In to add comment