Programmatically play youtube video on mobile device - javascript

I'm struggling with playing youtube video after a countdown from javascript. It is working in chrome but not in chrome on android devices.
The error is: "API can only be initiated by a user gesture".
The same problem arises with an html5 video, but in this case I was able to solve the issue thanks to andreybavt answer to this question.

Related

Video from RecordRTC not working in Safari

I have created a WordPress plugin that records reviews in video format with VideoJS (JS library). I am using Video.JS 7.14.3 with Video.JS-Record 4.5.0 and RecordRTC 5.6.2.
I am facing an error on the Safari browser, as seen in the image below:
When I click on the video to record it throws an error.
The videos that I previously recorded in a different browser do not play on Safari. The same issue happens anytime I try to play the recorded video.

How to make videos autoplay with sound in chrome or PWA

Chrome's updated it auto play policy which block user from autoplaying the video. I am having signage board where it is most important feature for my application. Is there any way I can autoplay the video? Please let us know if any solution or workaround is available. As per google document you can run video with sound in PWA app. I have tried that as will but unable to play the video. Thank you in advance. (https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#new-behaviors)
I have also referred multiple stack overflow question but haven't found any solution yet.

embed youtube video doesn't play automatically on device mode of google chrome

I'm trying to add embed youtube video in my Ionic project, just using iframe.
Once I added, it works on the normal web browser(Google Chrome).
However, if I changed view mode to device mode(F12 & Ctrl+Shift+M), and refresh browser, the embed video stopped auto-playing. Is there anyone have experience before fixed like this problem?
Here is the similar case with mine: http://jsfiddle.net/eFLqJ/1005/
This module will be helpful for your problem: https://github.com/orizens/ng2-youtube-player

Disable WebView's Embedded Video feature in Android 4.X devices

Recently I faced a problem with Youtube videos (iframe API) in WebView of Android 4.X devices.
The problem is onShowCustomView() not fired when video starts playing on Android 4.X devices. I searched for reason, why onShowCustomView() not fired? I got answer as in Android 4.X devices WebView has a feature Embedded Video, because of this video ( in HTML5) will be played by WebView and won't display the video in other Layout.
But when user requested Full Screen mode, then onShowCustomView() will be fired.
Actually I need the Full screen mode of youtube video by default, In Youtube's iframe API no such option to enter full screen, user has to press full screen button.
So for my requirement only 2 answers are there.
Disbaling of Embedded Video for my WebView, then it will work like below Android 4.X and onShowCustomView() will be fired.
Setting the full screen mode by default with Javascript in html file supplying to WebView.
So If anybody got solution to my problem please help me otherwise suggest me to solve this.

Pause HTML5 YouTube video on iPad

I am developing an iPad app that embeds YouTube videos in HTML5 format into a UIWebView. The problem is that I want to pause the video when a user brings up modal dialog windows, rather than clear or stop the video as many have suggested. This is critical to a good user experience. Does anyone know any JavaScript or API that I can run to simply pause the video when an action that presents a modal dialog will occur?
The method I use to embed is described here.
http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html
This blog explains hot to build a video in HTML 5.
http://blog.steveheffernan.com/2010/04/how-to-build-an-html5-video-player/
Then interact with the video player via the method [myWebView stringByEvaluatignJavaScriptFromString:#"playVideo()"].
I didn't tested but it seems straightforward.
Are you sure we can play embedded YouTube videos in mobile Safari?
Good luck!
Have you tried going through official docs?
https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/ControllingMediaWithJavaScript/ControllingMediaWithJavaScript.html

Categories