Avoid screen locking on mobile website - javascript

Is there any way of preventing a device to "sleep" when on the website?
(Desirable because of playing YouTube videos from a device on a website)

Look at this post
Prevent iOS mobile safari from going idle / auto-locking / sleeping?
It seems like it is currently not possible to implement. Youtube has this feature because they are using quicktime that keeps the device awake.

Related

How does the browser expose currently playing audio?

I’ve noticed that pressing Pause/Play media keys can control an audio player within Chrome, and I know that on mobile devices, you can even seek through whatever’s playing out of Safari / Chrome etc
Is there a way to programmatically seek a tab/browser’s currently playing audio? I’m wondering if there’s a w3c standard for this media key functionality and/or if theres an “extension” api to pause/play/seek or get info on what’s playing, because it seems to be exposed on mobile devices
I guess you are looking for the Media Session Standard.

Anyway can open mobile (for android and IOS) flash by using javascript?

I am doing a video call on the web, and I am trying to open the user's mobile flash when capture photo, is it anyway I can do this in javascript?
The flash I mentioned is the flashlight on mobile devices.
I had tried the media stream track method, but can only work for some devices only. cannot work on the iPhone.
thanks

Crosswalk webview on Cordova not resizing after fullscreen

I'm using Crosswalk webview on Cordova to display a webApp made with Ember.js.
In some pages the app have iframes which open a Vimeo player, and I allow them to play in fullscreen.
When the user plays it, it enters fullscreen automatically, resizing the page to increase its height. But, if the user closes fullscreen (or when the video ends and the fullscreen closes), the page isn't resized back to the original height, and my top menu gets hidden behind the mobile status bar.
If then I navigate to another url, the page gets resized and everything is beautiful again.
My question is: is there any javascript/CSS trick I could try to get around this?
INFO: I tested this against 2 phones, one Android 4.1 and the other Android 5.0, and it only happened in the Android 5.0 one. So maybe this is a Crosswalk bug. Doesn't happen at all if I use the native webView, but I wanted to avoid switching to it.
Any help appreciated ;)

Cross-browser mobile web solution for full-screen video

A button on my web app triggers an HTML5 video element to play in full screen. This works on iPhones because I added the "webkit-playsinline" element.
However, Androids and many other phones don't support "webkit-playsinline" - and I'm not sure about an alternative solution that is cross-browser mobile compatible.
Any suggestions on how to accomplish this — playing full-screen HTML5 video on Android and other devices?

Can mobile web apps run in the background? (iOS & Android)

Can mobile web apps run in the background? I'm mostly interest in iOS & Android.
Thanks!
Since this is a situation that changes almost daily, I'll post an updated answer. This applies to the recent releases of these browsers but may change tomorrow!
My music app is HTML5 and needs to run in the background. The support for that varies depending on mobile browser.
Safari on iOS: will continue to play one or two songs in the background
Native browser on Android: will play one song then stops
Firefox on Android: will stop when screen locks or browser loses focus or song ends
Dolphin on Android: plays in background but eventually stops
Opera on Android: Excellent background support! Javascript continues to run and music continues to play even when screen is off or Opera is sent to the background. Opera even puts a play/pause toggle into the notification page. Yay.
Here is a related SO question.
Nope, they can't. On Android you could conceivably install a different browser, but it's not possible on the stock one. #jgillman points out the exception of audio in iOS but that's the only exception I'm aware of.
iOS allows audio from a web app (Mobile Safari) to be played in the background. I don't know about other events though.
You can't run web app in the background. To enable most of the native features, you should develop native application.
At the time of this answer, Firefox mobile and Opera mobile for Android do allow javascript to run in the background, even with the screen locked.

Categories

Resources