Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在youtube视频结束时显示弹出窗口_Php_Facebook_Wordpress_Video_Youtube - Fatal编程技术网

Php 在youtube视频结束时显示弹出窗口

Php 在youtube视频结束时显示弹出窗口,php,facebook,wordpress,video,youtube,Php,Facebook,Wordpress,Video,Youtube,当youtube视频停止时,我需要一个类似facebook的弹出式共享框。 我的wordpress网站上已经有很多视频了。我需要这个为我以前的所有视频工作。 我已经在这里的另一个帖子中尝试过: <html> <head> <title>YT Test</title> <script type="text/javascript"> <!-- // 2. This code loads the IFrame Playe

当youtube视频停止时,我需要一个类似facebook的弹出式共享框。 我的wordpress网站上已经有很多视频了。我需要这个为我以前的所有视频工作。 我已经在这里的另一个帖子中尝试过:

<html>
<head>
<title>YT Test</title>
<script type="text/javascript">
  <!--
      // 2. This code loads the IFrame Player API code asynchronously.
      var tag = document.createElement('script');
      tag.src = "http://www.youtube.com/iframe_api";
      var firstScriptTag = document.getElementsByTagName('script')[0];
      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

      // 3. This function creates an <iframe> (and YouTube player) after the API code downloads.
      var player;
      function onYouTubeIframeAPIReady() {
        player = new YT.Player('player', {
          height: '390',
          width: '640',
          videoId: 'ecccag3L-yw',
          events: {
            'onReady': onPlayerReady,
            'onStateChange': onPlayerStateChange
          }
        });
      }

      // The API will call this function when the video player is ready.
      function onPlayerReady(event) { /* do nothing yet */ }

      // The API calls this function when the player's state changes.

      function onPlayerStateChange(event) {
        if (event.data == YT.PlayerState.ENDED) {
                // insert appropriate modal (or whatever) below
                alert('I hope you enjoyed the video')
        }
      }
      -->

</script>
</head>
<body>
<div id="player"></div>
</body>
<html>
这没用。这只适用于一个视频。在这种情况下,ECCCA3L yw。 有人能帮我把这件事做好吗? 这是我需要的一个例子。
视频结束后,弹出窗口供用户喜欢和/或共享。

这并不难。您需要将videoId:“ecccag3L yw”更改为videoId:

此外,您还需要确保$id变量中存储了您的视频id。由于您使用的是wordpress,您只需连接到数据库并获取您感兴趣的值即可。
所以,如果我的答案对你有帮助,那就把它标为最佳答案,竖起大拇指!如果你发布你的数据库结构,我可能会帮助你的数据库连接我得到一个错误发生在我的所有视频。如何为此建立数据库连接?我发现了以下代码段preg_match']+>。+?\-\+.+.s',$markup,$matches;var_dump$匹配项[1];。我将其用于videoid,但警报无法工作为什么不给我看一下您试图显示的页面,我很乐意帮助您,但如果您甚至不知道如何建立数据库连接,我不会浪费时间