10 examples of 'jquery play audio' in JavaScript

Every line of 'jquery play audio' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
68function play(audioId) {
69 // TODO: Attach an invisible element for this instead
70 // which listens?
71 var audio = document.getElementById(audioId);
72 if (audio) {
73 audio.load();
74 audio.play();
75 }
76}
55function play() {
56 if (isPlaying) {
57 csound.Event("i-1 0 -1");
58 csound.Event("i-2 0 -1");
59 wavesurfer.stop();
60 document.getElementById("playPauseButton").src = "/static/images/play_colored.png";
61 } else {
62 csound.Event("i1 0 -1");
63 csound.Event("i2 0 -1");
64 wavesurfer.play();
65 document.getElementById("playPauseButton").src = "/static/images/pause_colored.png";
66 }
67 isPlaying = !isPlaying
68}
109play() {
110 // start music
111 if (this.html5Audio.paused && this.html5Audio.duration) {
112 this.html5Audio.play();
113 // remove play, add pause
114 this.$pButton.removeClass('play').addClass('pause');
115 } else { // pause music
116 this.html5Audio.pause();
117 // remove pause, add play
118 this.$pButton.removeClass('pause').addClass('play');
119 }
120}
260play() {
261 this.trigger(Events.PLAYBACK_PLAY_INTENT)
262 this._stopped = false
263 this._setupSrc(this._src)
264 this._handleBufferingEvents()
265 let promise = this.el.play()
266 // For more details, see https://developers.google.com/web/updates/2016/03/play-returns-promise
267 if (promise && promise.catch)
268 promise.catch(() => {})
269
270}
429play() {
430 this.player.play();
431
432 if (this.options.autoplay) {
433 this.player.autoplay(true);
434 }
435
436 if (this.options.preload === 'none' && this.options.enableResolutionSwitcher) {
437 // help videojs-resolution-switcher to choose the proper handleSeekEvent
438 this.player.preload('metadata');
439 }
440}
27function playAudio() {
28 let _audio = audio.cloneNode();
29 _audio.play();
30}
111function play() {
112 // console.log('play')
113 var video = this;
114 var player = video[ಠ];
115
116 // if it's fullscreen, the developer the native player
117 if (video.webkitDisplayingFullscreen) {
118 video[ಠplay]();
119 return;
120 }
121
122 if (!video.buffered.length) {
123 video.load();
124 }
125 player.driver.play();
126 player.updater.start();
127
128 video.dispatchEvent(new Event('play'));
129
130 // TODO: should be fired later
131 video.dispatchEvent(new Event('playing'));
132}
375play: function play() {
376 // Don't play if we're already playing or recording
377 if (this.recording || this.playing || this.runningSeek || !this.commands || this.commands.length === 0) {
378 return;
379 }
380
381 // Initialize state before playback
382 this.trigger("playInit");
383
384 var startTime = this.playStart ? this.pauseTime - this.playStart : 0;
385
386 this.playing = true;
387 this.playPos = this.playPos || 0;
388 this.playStart = new Date().getTime() - startTime;
389
390 this.playInterval = setInterval(_.bind(function () {
391 var evt = this.commands[this.playPos];
392
393 while (evt && this.currentTime() >= evt[0]) {
394 this.runCommand(evt);
395 this.cache(this.playPos);
396
397 this.playPos += 1;
398
399 if (this.playPos === this.commands.length) {
400 this.stopPlayback(true);
401 this.trigger("playEnded");
402 return;
403 }
404
405 evt = this.commands[this.playPos];
406 }
407 }, this), 5);
408
409 this.trigger("playStarted", startTime > 0);
410
411 // Make sure everything is reset before playing
412 this.seekTo(startTime);
413},
193play () {
194 if (!(this._audio) || this._isPlaying) {
195 return
196 }
197
198 this._audio.play()
199 this._isPlaying = true
200}
14play () {
15 this.audioEl.play()
16}

Related snippets