H
H
Herman Martin2018-04-07 16:27:43
YouTube
Herman Martin, 2018-04-07 16:27:43

How to make youtube embed video work forever in php?

Good afternoon.
There is a code: and
$v->link = 'super_cool_video_ID';

<iframe
                        width="100%" height="250"
                        src="https://www.youtube.com/embed/<?=$v->link?>"
                        frameborder="0" allow="autoplay; encrypted-media"
                        allowfullscreen>
                    </iframe>

which embeds the video, the problem is that it is not always shown correctly, over time, not 1 video from YouTube is played on the remote site. If you go to YouTube. that works. It helps to restart the browser / OS, etc. unpopular decisions. The site uses YouTube API to search and add videos.
Are there ways in the api itself to make the video work without going to the YouTube site itself?
On the same VK, for example, no one noticed a similar problem

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
frees2, 2018-04-07
@dklight

I didn't understand the question at all, so I'm embedding it like this.

var player;  function onYouTubeIframeAPIReady() 
{ player = new YT.Player('player',{ videoId:'<?php echo''.$fulluri2.'' ; ?>',
playerVars: { autoplay: 1, html5: 1, theme: "light", modesbranding: 0,
color: "white", iv_load_policy: 3, showinfo: 0, controls: 2, 'wmode':'opaque',<?php  echo ''.$list.''; ?>}, }); }  
var tag = document.createElement('script');tag.src = "https://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question