youtube-iframe-api

YouTuve IFrame API trouble with playerVars

为君一笑 提交于 2021-01-29 12:22:00
问题 I want to start my video at certain times of the day. This is 'script.js': var player; function createPlayer() { player=new YT.Player('main-block',{ height:'400', width:'400', playerVars:{ 'rel':0, 'controls':0, 'showinfo':0, 'disablekb':1, 'modestbranding':1, 'enablejsapi':1 }, videoId:'tgbNymZ7vqY', events:{ 'onReady':onPlayerReady } }); } function onPlayerReady(event) { document.getElementById("timer").style.display='none'; event.target.playVideo(); } function clockPlayer(){ var now = new

Youtube videos shown black screen in webView when click on play button

徘徊边缘 提交于 2021-01-29 03:32:16
问题 I tried this but it doesn't work: webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl(String.valueOf("https://techx.pk/youtube-videos/")); webView.setWebViewClient(new WebViewClient(){ public boolean shouldOverrideUrlLoading(WebView view, String url){ view.loadUrl(url); return false; } }); It only plays a video but showing a black screen. 来源: https://stackoverflow.com/questions/58112959/youtube-videos-shown-black-screen-in-webview-when-click-on-play-button

YouTube-iFrame-API doesn't work on Chrome v.72

倖福魔咒の 提交于 2021-01-28 19:30:32
问题 "player.play()" doesn't work on Chrome(v.72). This bug happens on windows7 and Android phone.(I don't know about iOS.) It works well on other versions. Is there anyone who knows about this bug? 回答1: I ran into the same problem. Adding allow="autoplay" to my parent iframe fixed it as well 回答2: Is your youtube iframe wrapped in another iframe (crossdomain)? If so then it could be caused by the new user activation api v2 (https://developers.google.com/web/updates/2019/01/user-activation)? And

Youtube iFrame Api for live videos?

耗尽温柔 提交于 2021-01-27 14:26:47
问题 I'm trying to implement live video from youtube channel with youtube iframe api. There is a videoId property in api and it works for live videos too but we have to add video id every stream start. There is a solution in iframe live video https://www.youtube.com/embed/live_stream?channel=CHANNEL_ID . How can i use it in iframe api? 回答1: I came across this same issue. I figured out that you can directly add the iframe with the src instead of an empty div. Then give it an id and pass that to the

Problems with Youtube Iframe Api to start playing video on Chrome

冷暖自知 提交于 2021-01-21 08:12:00
问题 I have following starting setup: var player; function onYouTubeIframeAPIReady() { player = new YT.Player('player', { events: { 'onReady': onPlayerReady, 'onStateChange': onPlayerStateChange } }); } Then in onPlayerReady handler I added event listener to button which is outside iframe: function onPlayerReady(event) { button.addEventListener('click', () => event.target.playVideo()); } In onPlayerStateChange I'm just logging what is happening: function onPlayerStateChange(event) { console.log

How to listen to time change events with the YouTube IFrame Player API?

▼魔方 西西 提交于 2021-01-07 01:30:36
问题 I couldn't find any way to listen to time changes (so I can show a current time/duration of the video in my UI) on the YouTube IFrame Player API documentation. Is there a way to do this without polling getCurrentTime() ? 回答1: The YouTube IFrame Player API doesn't expose any way to listen for time change updates, but since internally it uses postMessage events to communicate between the IFrame and the main window, you can add a listener to your window to listen to them and react only to the

How to listen to time change events with the YouTube IFrame Player API?

穿精又带淫゛_ 提交于 2021-01-07 01:25:19
问题 I couldn't find any way to listen to time changes (so I can show a current time/duration of the video in my UI) on the YouTube IFrame Player API documentation. Is there a way to do this without polling getCurrentTime() ? 回答1: The YouTube IFrame Player API doesn't expose any way to listen for time change updates, but since internally it uses postMessage events to communicate between the IFrame and the main window, you can add a listener to your window to listen to them and react only to the

How to find out when a youtube embedded iframe is loaded

三世轮回 提交于 2020-08-08 06:00:32
问题 I am trying to embed a youtube iframe into my application and listen to when that youtube video is loaded and ready to be played; my idea is to have a user press a play button, and not be shown the autoplaying embedded video until the video is completely ready to be played, and thus the user doesn't have to press a button and then wait for the embedded player to load. I tried taking a look at this youtube iframe api documentation and various related stack overflows but still find myself stuck