youtube-iframe-api

onReady not being called

十年热恋 提交于 2019-12-24 19:51:50
问题 var player = null; function LoadYouTubeIframeAPI() { var scriptElement = document.createElement("script"); scriptElement.src = "http://www.youtube.com/iframe_api"; var firstScriptElement = document.getElementsByTagName("script")[0]; firstScriptElement.parentNode.insertBefore(scriptElement, firstScriptElement); } function onYouTubeIframeAPIReady() { var playerParams = { playerVars: { "enablejsapi": 1, "origin": document.domain, "rel": 0 }, events: { "onReady": onPlayerReady, "onError":

Youtube iframe api auto play not working for chrome and video resolution set not working for all browser

天大地大妈咪最大 提交于 2019-12-24 17:24:20
问题 <script> var tag = document.createElement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); var player; function onYouTubeIframeAPIReady() { player = new YT.Player('youtube-vid', { videoId: 'M7lc1UVf-VE', events: { 'onReady': onPlayerReady, 'onStateChange': onPlayerStateChange } }); } function onPlayerReady(event) { event.target.playVideo(); event.target

YTPlayerView load a list of videos

混江龙づ霸主 提交于 2019-12-24 02:04:02
问题 i am trying to play Youtube videos on my app. I am using YTPlayerView library for playing a video by video id. Problem is when i am trying to play a list of videos player showing an error that "An error occurred. Please try again later. (Playback ID: someid)". I am using the following code for playing a single video @IBOutlet weak var playerView: YTPlayerView! // story board connection let params = ["controls" : 2, "playsinline" : 1, "autohide" :1, "showinfo" : 0, "modestbranding" : 0, "cc

How to resume embedded YouTube video?

独自空忆成欢 提交于 2019-12-24 01:39:32
问题 I used //www.youtube.com/embed/JDcaMVwCr3c?wmode=opaque&showinfo=0&autoplay=1&controls=0&modestbranding=1&vq=&rel=0 url to embed a video in my site. Now, if a user visits the site, the video will be played, but if the user doesn't watch the full video and reload page or leave the site and come back again after some time then the video is now playing from the beginning. I would like to resume the video from the point which the user has left it. In the same way as the YouTube site does. Is this

iOS YTPlayerView force video quality

十年热恋 提交于 2019-12-24 00:26:08
问题 I am currently using iOS-youtube-player-helper library in our application. There is a view controller, with a YTPlayerView that has an aspect ratio of 16:9, which means it takes only a part of the screen. The video is loaded in medium and no matter how, I could not get it to play in 720P or 1080P. I am certain that these qualities are available, it's just the YTPlayerView forcing the quality based on the video player height. Because this is a library and not direct iframe embed, I cannot use

How to identify volume change in youtube player

给你一囗甜甜゛ 提交于 2019-12-23 20:33:00
问题 I am using 'angualr-youtube-embed' directive to embed youtube player in my angular web app. In that I have to identify play and pause and volume change events. To listen play and pause events I am using the below given code. $scope.$on('youtube.player.playing', function ($event, player) { // to do functions when the video is playing. }); $scope.$on('youtube.player.paused', function ($event, player) { // to do functions when the video is paused. }); Now my requirement is, I want to do some

Youtube iframe api allow=“autoplay” Chrome 65

拟墨画扇 提交于 2019-12-23 07:46:10
问题 Chrome 65, the current canary version, is blocking iframed youtube videos from auto playing with sound. The latest changes to Chrome require the iframe to have allow="autoplay" How do I go about adding allow="autoplay" to the youtube iframe api? I can't find it in any of the documentation. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#iframe A feature policy allows developers to selectively enable and disable use of various browser features and APIs. Once an origin

onYouTubeIframeAPIReady() not firing

房东的猫 提交于 2019-12-23 06:48:36
问题 I've looked through so many questions and the youtube api stuff but for the life of me can't figure out why the onYouTubeIframeAPIReady is not working. Here is my iframe: <iframe id="youtube_vid" width="763" height="430" src="https://www.youtube.com/embed/dlJshzOv2cw?theme=light&showinfo=0&rel=0&enablejsapi=1" frameborder="0" allowfullscreen=""></iframe> And my script: function callYTapi() { var tag = document.createElement('script'); tag.src = "https://www.youtube.com/iframe_api"; var

How to add YouTube video as <video> instead of an embedded <iframe>?

半腔热情 提交于 2019-12-23 04:49:44
问题 I have to insert a full width video on a website. Because of problems of weight and design, I would like to know if I can specify the YouTube video as the src attribute of a <video> tag instead of an embedded <iframe> . I would like to have a YouTube video without the design of the player and be as compatible with different devices as possible (e.g. browser, smartphones, tablets). Do you have any ideas or solutions? 回答1: As far as I know, you cannot embed video to webpage any other way that

Detect youtube iframe autoplay failure

天大地大妈咪最大 提交于 2019-12-23 02:16:25
问题 iOS and Android only allow playing a video inside a callback of a user interaction. Chrome 66 introduced the autoplay policy. How can we detect that embedded youtube iframe failed to autoplay a video so we can play it muted and show 'tap to unmute' button? The API has onError callback but it's not clear if and what error will fire. This is also hard to test because of Chrome's Media Engagement Index. HMTL 5 video autoplay failure can be detected. Is there an equivalent in the YouTube iframe