Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php include('../membre/include/head.php'); ?>
- <?php include('../include/menu.php'); ?>
- <div class="container">
- <!-- Formulaire -->
- <form method="post" action="creation_murmur.php">
- <hr>
- <div class="row">
- <div class="col-lg-6">
- <label for="nom">Nom de la demande :</label>
- <input class="form-control" type="text" id="nom" name="nom">
- </div>
- </div><br>
- <div class="row">
- <div class="col-lg-6">
- <label for="description">Description du titre recherché :</label>
- <textarea class="form-control" rows="5" id="description" name="description"></textarea>
- </div>
- </div><br>
- <hr>
- <button class="btn btn-large btn-primary" onclick="startRecording(this);">Enregistrer</button>
- <button class="btn btn-large btn-primary" onclick="stopRecording(this);" disabled>Arreter l'enregistrement</button>
- <h2>Votre enregistrement :</h2>
- <ul id="recordingslist"></ul>
- <h2>Log</h2>
- <pre id="log"></pre>
- <script>
- function __log(e, data) {
- log.innerHTML += "\n" + e + " " + (data || '');
- }
- var audio_context;
- var recorder;
- function startUserMedia(stream) {
- var input = audio_context.createMediaStreamSource(stream);
- __log('Media stream created.' );
- __log("input sample rate " +input.context.sampleRate);
- input.connect(audio_context.destination);
- __log('Input connected to audio context destination.');
- recorder = new Recorder(input);
- __log('Recorder initialised.');
- }
- function startRecording(button) {
- recorder && recorder.record();
- button.disabled = true;
- button.nextElementSibling.disabled = false;
- __log('Recording...');
- }
- function stopRecording(button) {
- recorder && recorder.stop();
- button.disabled = true;
- button.previousElementSibling.disabled = false;
- __log('Stopped recording.');
- // create WAV download link using audio data blob
- createDownloadLink();
- recorder.clear();
- }
- function createDownloadLink() {
- recorder && recorder.exportWAV(function(blob) {
- /*var url = URL.createObjectURL(blob);
- var li = document.createElement('li');
- var au = document.createElement('audio');
- var hf = document.createElement('a');
- au.controls = true;
- au.src = url;
- hf.href = url;
- hf.download = new Date().toISOString() + '.wav';
- hf.innerHTML = hf.download;
- li.appendChild(au);
- li.appendChild(hf);
- recordingslist.appendChild(li);*/
- });
- }
- window.onload = function init() {
- try {
- // webkit shim
- window.AudioContext = window.AudioContext || window.webkitAudioContext;
- navigator.getUserMedia = ( navigator.getUserMedia ||
- navigator.webkitGetUserMedia ||
- navigator.mozGetUserMedia ||
- navigator.msGetUserMedia);
- window.URL = window.URL || window.webkitURL;
- audio_context = new AudioContext;
- __log('Audio context set up.');
- __log('navigator.getUserMedia ' + (navigator.getUserMedia ? 'available.' : 'not present!'));
- } catch (e) {
- alert('No web audio support in this browser!');
- }
- navigator.getUserMedia({audio: true}, startUserMedia, function(e) {
- __log('No live audio input: ' + e);
- });
- };
- </script>
- <script src="recordmp3.js"></script>
- <div class="row">
- <button class="btn btn-large btn-success" type="submit">Envoyer</button>
- </div>
- </form>
- </div> <!-- /container -->
- <?php include('../include/footer.php') ?>
Advertisement
Add Comment
Please, Sign In to add comment