上传时prevent空闲状态(在iOS上的Web应用程序)应用程序、状态、上传、prevent

由网友(抱着星星睡觉)分享简介:我建设将在移动和桌面使用的Web应用程序,并测试在iOS后,我发现我的手机将进入空闲状态(屏幕关闭,presented与锁屏在返回),即使有被上载的文件(AJAX上传)。有没有什么办法prevent这种情况的发生?I'm building a web application that will be used on...

我建设将在移动和桌面使用的Web应用程序,并测试在iOS后,我发现我的手机将进入空闲状态(屏幕关闭,presented与锁屏在返回),即使有被上载的文件(AJAX上传)。有没有什么办法prevent这种情况的发生?

I'm building a web application that will be used on mobile and desktop, and after testing on iOS, I've noticed that my phone will go into an idle state (screen turns off, presented with lock screen on return) even if there is a file being uploaded (ajax upload). Is there any way to prevent this from happening?

我运行它作为一个家筛选的Web应用程序测试的应用程序,如果有差别。(即您保存在主屏幕网站)

I'm testing the app by running it as a 'home-screened' web app (ie. a website you've saved to the home screen) if that makes a difference.

推荐答案

本来我无法找到一个答案(最可能是由于我的特殊问题的措辞),但我最终加入以下到我的上传

Originally I couldn't find an answer to this (most likely due to my particular phrasing of the question), but I ended up adding the following to my upload modal which prevented my phone from sleeping while the modal was open (only tested on iOS7):

<div style="display:none">
   <audio id="prevent_sleep" style="display:none" src="prevent_sleep.mp3" onended="this.play();" controls loop autobuffer autoplay></audio>
</div>
//prevent_sleep.mp3 is a 10 second silent mp3 file

<script>
   window.onload = function() {
      var audioEl = document.getElementById("prevent_sleep");

      audioEl.load();
      audioEl.play();
   };
</script>

我发现在 HTTP:/ /flax.ie/how-to-get-hidden-autoplaying-audio-in-html5-on-ios/

阅读全文

相关推荐

最新文章