html5-audio

passing audio from mongodb to audio tag

好久不见. 提交于 2020-08-23 06:59:11
问题 For my project I'm trying to create an audio player. The database aspect of storing files is new to me as I've only stored strings before. So far, what I've been able to do is: Store the audio file into the database.(I'm linking to a file here for simplicity but in the future it will be uploaded) Retrieve the audio file as an object. Store the audio file in the public folder for use. Server side code (the route code is separate from the server code) let fs = require('fs'); var bodyParser =

What do [] brackets after a Jquery selector mean?

我的未来我决定 提交于 2020-07-30 04:56:45
问题 I'm using this code to play a preloaded mp3 file. var shuffle = $("#shuffle")[0]; shuffle.play(); Shuffle is my id. I got the code off the net but I CANNOT figure out what the [0] after the jquery selector does. The sound does not play if I remove it.What does it do? thanks 回答1: jQuery is an array-like object that contains all of your matched elements. Often times, jQuery will by default apply its changes to the first element in the collection: $("li").css("display"); // display val of first

'audio/wav' mime type not supported by MSE SouceBuffer object, but audio src attribute pointing at .wav plays just fine

狂风中的少年 提交于 2020-07-22 05:53:07
问题 I'm trying create a SourceBuffer from the W3 Media Source Extension API with Mime type 'audio/wav' like so: let sourceBuffer = mediaSource.addSourceBuffer('audio/wav'); However I get a "NotSupportedError": Failed to execute 'addSourceBuffer' on 'MediaSource': The type provided ('audio/wav') is unsupported. Also, running the following: MediaSource.isTypeSupported('audio/wav'); in the browser console returns false for both recent versions of firefox and chrome. If I just set the src of the

PCM support in WebM, and Chrome's WebM implementation

家住魔仙堡 提交于 2020-07-03 07:30:25
问题 Does WebM support PCM for the audio codec? I didn't think it did, but I see on the WebM documentation page that there is support for a BitDepth field with the following comment: BitDepth - Bits per sample, mostly used for PCM. If WebM does support PCM, does Chrome's implementation? And if it does, what is the appropriate content type for use with MediaRecorder? These all return false: MediaRecorder.isTypeSupported('video/webm;codecs=h264,pcm'); MediaRecorder.isTypeSupported('video/webm;codecs

How to autoplay audio when the countdown timer is finished?

帅比萌擦擦* 提交于 2020-06-28 08:33:51
问题 I want to play a sound after the countdown timer is done. Normally I will do it using this peace of code var audio = new Audio('path to file.mp3'); audio.play(); But I get the following error Unhandled Promise Rejection: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission. The thing is ... Google it self is doing it using a HTML5 audio tag If you type countdown timer into google search field it

Audio won't be muted with JavaScript - removing audio tags with mutationobserver needed

耗尽温柔 提交于 2020-06-18 14:41:53
问题 I tried to use the following userscript to remove all audio from a certain website: // ==UserScript== // @name addicto // @namespace nms // @include http://* // @include https://* // @version 1 // @grant none // ==/UserScript== addEventListener('DOMContentLoaded', ()=>{ let sites = ['mako.co.il']; let href = window.location.href; for (let i = 0; i < sites.length; i++) { if (href.includes(sites[i])) { Array.prototype.slice.call(document.querySelectorAll('audio')).forEach((audio)=>{ audio.muted

Audio won't be muted with JavaScript - removing audio tags with mutationobserver needed

▼魔方 西西 提交于 2020-06-18 14:36:48
问题 I tried to use the following userscript to remove all audio from a certain website: // ==UserScript== // @name addicto // @namespace nms // @include http://* // @include https://* // @version 1 // @grant none // ==/UserScript== addEventListener('DOMContentLoaded', ()=>{ let sites = ['mako.co.il']; let href = window.location.href; for (let i = 0; i < sites.length; i++) { if (href.includes(sites[i])) { Array.prototype.slice.call(document.querySelectorAll('audio')).forEach((audio)=>{ audio.muted

How to distinguish between two “onpause” events - caused by clicking “pause” button, and caused by reaching the end of a media fragment?

孤街浪徒 提交于 2020-06-12 02:48:49
问题 If the user wants to stop the HTML5 media, for example by clicking “pause” native control button, we get "onpause" event. At the same time, if media element reaches the end of the specified fragment, it triggers the same "onpause" event automatically. Is it possible to separate one from another? In JQuery style, <video id="video1" src="url/video.webm#t=10,20" controls></video> <script type="text/javascript"> $(window).load(function () { $('#video1').on("manualpause", function () { alert("you

How to distinguish between two “onpause” events - caused by clicking “pause” button, and caused by reaching the end of a media fragment?

Deadly 提交于 2020-06-12 02:48:26
问题 If the user wants to stop the HTML5 media, for example by clicking “pause” native control button, we get "onpause" event. At the same time, if media element reaches the end of the specified fragment, it triggers the same "onpause" event automatically. Is it possible to separate one from another? In JQuery style, <video id="video1" src="url/video.webm#t=10,20" controls></video> <script type="text/javascript"> $(window).load(function () { $('#video1').on("manualpause", function () { alert("you

Problem when using echo'd ++$value in javascript as part of a html5 audio player page

纵然是瞬间 提交于 2020-05-16 04:22:24
问题 I have been making myself a 'soundboard' that populates a custom HTML5 audio player for each mp3 file it finds in a directory. Now that side of it is all working exactly as I expected but my problems started when I have attempted to add a custom timer which uses javascript. For each player, I was able to make custom controls and make the variables all marry up with things like <audio id="player<?php echo $count1++;?>" src="audio/<?php echo rtrim($file, " "); ?>"></audio> So using PHP echo a