How to start play audio automaticly on mobyle device? - audio

I crate audio tag, and use 'autoplay' to start audio. On Descktop work well, but not work on mobile device: ipad, winphon, android 4+...
<audio id="myAudio" onerror="toConvert()" class="full-width" src="{{ direct_link }}" controls autoplay onpause="$('#play_ico').show()" onplaying="$('#play_ico').hide()"></audio>
I tried using jquery, js, canplay, canplaythrougt and many other methods from web, but they dont work in mobile and working well on descktop....
How can I start playing audio on mobile device?
I use: goRatchet, Bootstrap and Django.

In Safari on iOS (for all devices, including iPad), where the user may
be on a cellular network and be charged per data unit, preload and
autoplay are disabled. No data is loaded until the user initiates it.
This means the JavaScript play() and load() methods are also inactive
until the user initiates playback, unless the play() or load() method
is triggered by user action. In other words, a user-initiated Play
button works, but an onLoad="play()" event does not.
This plays the movie: <input type="button" value="Play" onclick="document.myMovie.play()">
This does nothing on iOS: <body onload="document.myMovie.play()">
You can ref: Playing Sounds with the Web Audio API.

Related

How YouTube website can use autoplay feature function without DOMException

I wonder why YouTube can use autoplay feature without DOMException because when I tried to use <audio/> and <video/> tags with autoplay when loaded, It's show an DOMException error. I tried another way by set an attribute playInLines={true} and muted={true} it first, then called ref.current.play() and finally unmute it. Unfortunately, the browser isn't allow to play without user interact first by showing DOMException error.
When I using YouTube website, I noticed that YouTube won't autoplay until I switched back to YouTube tab, the video is autoplayed.
I searched from internet that YouTube website is built from the framework that load only the element that it needed, the other element won't refreshed.
Is YouTube a Single Page Application. If it isn't, when the user interacted first time on loaded, can the website play the videos forever? (not counted the AFK interruption (YouTube Premium user won't encountner this))
I don't have any knowledge but I guess that YouTube is using the both of <audio/> and <video/> tags.

How can i handle "turn it down" from my Google Assistant skill?

I am trying to make a music player app that plays music one after the other. Here is a sample conversation:
User: play Beyblade sound
Appl: Playing "Beyblade Burst: The LOUDEST Beyblade?" by "Kevo"
User: turn it down
Appl: <default fallback>
What can i do here? Is there a way i can ask google to handle that request without closing my app?
It is a known bug currently that volume controls aren't available inside a Conversational Action (either when playing a Media response or audio through SSML).

Implementing twitter audio card like soundcloud

I want to implement audio card like soundclound, basically when I made audio card it was working fine in web, but when I tried playing same card in mobile app but it was redirecting to web browser. so the thing is I want my audio to play in the app itself not to redirect and open a new page on web . let me know if anyone has some idea about implementation of the same.
The only way to implement an audio card for yourself would be to use Twitter's player card option. On mobile, that will end up redirecting to a browser.
The Soundcloud card is a special card implemented by Twitter, and is not generally available to other sites.

UWP WebView with audio tag not playing

I have WebView that is supposed to play some audio tags from webpages it is showing with similar code like this:
<audio preload="auto"
data-reactid="main.5.1.0x"
src="blob:https%3A//www.lsdfsdf.com/584b1e6d-47a6-4a58-a7d4-e5e7633c32a8">
</audio>
It seems it loads the audio but then doesn't play it. On a next click it loads again but then doesn't play it. I am now not sure if the loading doesn't work since it is a blob url or a permission issue with the WebView itself.
When I open the same webpage in a browser, everything works fine.

Spotify Play Button - autoplay?

I am trying to integrate Spotify Play Button into ThingLink Spotify tag so that when the iframe loads, it starts playing automatically. Is there a way to do that with some parameter?
The functionality would be similar to Soundcloud & Vimeo players here:
http://www.thinglink.com/scene/251225958915244034
Without the autoplay, user would have to click on Play twice, which wouldn't be that good of UX.
Thanks!
-Albert
There is no autoplay functionality at present.
Autoplay isn't really what the Play Button is about — it's designed so people can listen to music if they want to. We don't really want to interrupt whatever the user is listening to already (be it something in Spotify, something else, or silence) without express permission to do so first.

Resources