Stop HTML5 animation from outside the web browser - javascript

I need to stop a HTML5 animation from outside the Web browser.
I have tablets that are showing HTML5 pages with animations.
So, I have a Web View (Basic4Android) in my Android Application that shows the HTML5 web pages.
When an event occurs on the App, I need to stop/pause/play/resume the HTML5 animation.
Is it possible? Is it possible to call javascript functions/events from the App?
Thanks!
Regards.

You need to execute javascript code which will stop animation on page. Please have a look at thread Execute javascript from code

Related

How to detect WKWebView is being closed, from javascript

We play streaming audio with javascript that is running in a WKWebView object on iOS. If that WKWebView is destroyed or no longer displayed, the audio will oftentimes continue playing to completion. The only way for the user to stop the audio is to swipe up to get the lock screen playback controls and hit 'pause'.
Is there a way for the javascript in the WKWebView to be notified that it is about to be shut down, so that it can stop playback of the audio before the WKWebView is destroyed?
I've tried hooking into 'pagehide', 'unload', 'beforeunload', and 'visibilitychange' events, with no luck.
I'm sure a custom event could be triggered from the native code, but I don't have control of that side of things. Is there anything else that works?
This bug was apparently fixed in iOS 8.3+, but the suggested answer of loading a blank page as the view disappears works very well and could be useful if supporting apps running on older OS versions. This approach is also much more resilient than relying on each JS implementation running in the WKWebView to stop its own media playback after being notified of the impending 'shutdown' of the web view:
In your WKWebView view controller class' -(void)viewDidDisappear:(BOOL)animated method, run the following code to load a blank page into your web view. The code assumes your reference to your web view is self.webView, thus modify as needed.
// fix to prevent embedded audio/video from playing once the view has closed...
[self.webView loadHTMLString:#"<html/>" baseURL:nil];
See WKWebView embed video keeps playing sound after release for more details...

HTML5 audio/javascript stops working on android(google chrome) when screen is turned off

I have created a Web App which plays music playlist and it works well on desktop browsers and also in mozilla and opera of android. But When I play the songs on Chrome browser of Android and I turn off the screen, it stops after playing the current song. And as soon as I turn the screen on, it starts loading the next song in line.
From my observations, what I have understood is Google Chrome browser on android pauses the javascript code from executing if the screen is turned off till the screen is not waken up again. Is there any way I can prevent my specific library from pausing? Any approach or events?
Some related this question is what I am looking for: JavaScript halts in inactive android Chrome tab
There are so many WebApps which does not stop playing music. Does it need some permissions from Google App Store?
check what happens with youtube, at least few years ago i had an awful time dealing with that and that's what proved to my client it cant be done in the given time frame and budget. that was actually device specific, on some devices it worked fine and on others it didnt. check if it happens on other devices. the only solutions i could think of ware either to prevent screen turn off (on problematic devices or all of them at the beginning), or to build an app and handle onPause event
I don't think that you can change the behaviour of the Chrome app, if they want to save battery in the background and stop the javascript, you won't reactivate it.
There are maybe some other ways to get it working.
Tell your users that they should use Firefox or Opera on their mobile device.
All apps are allowed to play or stream music in the background, so you could make or use an app for your task.
Maybe you can use the default music player app on android. Open a playlist of streams using the app. (I don't know if this is possible, because I have no android device.)
I know that is not exactly what you want, but a maybe a way to get it working.

Liveweb Plugin for Powerpoint: Support for HTML5 Canvas?

I'm thinking of using the Liveweb plugin for Powerpoint, to embed a web page in a Powerpoint presentation.
Does Liveweb support HTML5 Canvas? Does it support Javascript?
Thanks very much in advance to all for any info.
Shyam Pillai's LiveWeb? It simply embeds an instance of the browser control into your presentation. It doesn't support any web technologies ... just turns the browser loose on them, so it'll depend on the MSIE version in place and what it supports and your Internet settings (ie, whether javascript is disabled or not).
Or the short version: Can't answer that. Try it for yourself and see. ;-)
So far it doesn't seem to be working. I can access a web page from inside a PowerPoint slide show. I can use the navigation on the page and navigate around the site. But when I go to a page that uses HTML5 Canvas, the Canvas objects don't yet appear.

YouTube force full screen on load

I've taken a look at the YouTube API and it seems quite clear (for security reasons) that the player (embedded or not) does not allow YouTube video to automatically initiate full screen once loaded.
I wondered if there was a way to do this using Javascript to act as if the user had pressed the full screen button?
Any ideas shared would be greatly appreciated.
I'm afraid you can't use the YouTube player API to initiate fullscreen programatically.
This is because the underlying issues with fullscreen in flash and html5 video would make such an api method seriously error-prone.
Official response to back me up:
https://groups.google.com/forum/#!msg/youtube-api-gdata/Tyv3vTw0RQk/449KahYVNFYJ

Play sound in iPhone web app with Javascript?

I'm currently creating an iPhone web application for piano chords, and I wanted to add an option that would let the user press a Play button and play the selected chord. However, I'm not sure how to do this, or if it's even possible.
Basically, is there any way to programmatically (through Javascript) play a sound file (wav, mp3,...) in the background? (i.e. not leaving the page)
Thanks for any help!
(Keep in mind that I'm developing a web app, so I'm using HTML, CSS & JS, not the native SDK)
short answer: no
from the docs:
Safari on iPhone plays audio and video
in webpages in fullscreen playback
mode only.
yes you can.
http://www.schillmania.com/projects/soundmanager2/
see it in action at soundcloud.com
With HTML5 audio, iPhone can play without fullscreen.
IOS requires sound be played with the press of a control button. If you are looking to autoplay a sound at some event on an HTML page, forget it.

Categories