Don't ask me why I can't automatically play video and audio in my mobile browser
Source: Internet
Author: User
<span id="Label3"></p><p><p><span style="font-size: 16px;">First of all, the <span style="font-family: ‘Courier New‘; line-height: 1.5;">mobile browser is mostly disable the AutoPlay function of video and audio;</span></span></p></p><p><p><span style="font-size: 16px;">also, Many mobile browsers do not support the first JS call play method to Play.</span></p></p><p><p><span style="font-size: 16px;">This is done primarily to prevent unnecessary automatic playback from wasting Traffic.</span></p></p><p><p><span style="font-size: 16px; color: #0000ff; background-color: #ffffff;">To implement an audio file that can play, you cannot hide the control that is Playing.</span></p></p><p><p></p></p><p><p>The JS method calls the play Code:</p></p><pre><pre><script><span style="color: #000000;"> $ (function () { $ (</span><span style="color: #800000;">"</span><span style="color: #800000;">#body</span><span style="color: #800000;">"</span>). on (<span style="color: #800000;">"</span> <span style="color: #800000;"> Touchstart</span><span style="color: #800000;">"</span><span style="color: #000000;">, function () { audio.play (); }); });</span> </script></pre></pre><p><p></p></p><pre><pre><audio src=<span style="color: #800000;">"</span><span style="color: #800000;">a.mp3</span><span style="color: #800000;">"</span> controls=<span style="color: #800000;"></span>"<span style="color: #800000;">controls</span><span style="color: #800000;">"</span> autoplay= "<span style="color: #800000;"> </span> <span style="color: #800000;">AutoPlay</span><span style="color: #800000;">"</span> loop=" true "hidden=<span style="color: #800000;">"</span><span style="color: #800000;">true</span><span style="color: #800000;">"</span>></audio></pre></pre><pre><pre>controls= "controls" : Display Music controls;<br><br></pre></pre><pre><pre>autoplay= "autoplay" : Auto play;<br><br></pre></pre><pre><pre>loop= "true" : Loop playback;<br><br></pre></pre><pre><pre>hidden= "true" : Hidden.</pre></pre><p><p></p></p><p><p>Don't ask me why I can't automatically play video and audio in my mobile browser</p></p></span>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.