flowplayer暂停和恢复广告的问题

时间:2019-05-13 19:14:51

标签: javascript reactjs flowplayer vast

我需要你的帮助 我在flowplayer 7.2.7和更大版本上遇到问题。 当视频开始播放广告时,当视频结束播放时自动播放音频内容,如果我按停止,则视频停止,这很好,但是当我再次按开始时,仅加载视频但不播放。 我在react组件内部有按钮,flowplayer在索引中。 另外,当我尝试播放和停止广告时,什么也没发生。 我尝试订阅flowplayer.AdEvents失败。 你能帮我吗? (对不起,我的英语不好)

在此处粘贴代码。谢谢!

index.html

<!doctype html>

<html>

<head>
   <meta charset="utf-8">
   <meta name="theme-color" content="#000000" />
  <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />

    <script>
        lsdStatsAccount = 2;
    </script>


      <!-- Flowplayer depends on jquery for video tag based setups -->
   <script src="//code.jquery.com/jquery-1.12.4.min.js"></script>

   <!-- Flowplayer, commercial version-->
   <script src="//releases.flowplayer.org/7.2.7/commercial/flowplayer.min.js"></script>
    <!-- Flowplayer hlsjs engine for smoother HLS playback in modern browsers (optional) -->
    <script src="//releases.flowplayer.org/hlsjs/flowplayer.hlsjs.min.js"></script>

    <!-- load the VAST assets after the Flowplayer assets -->
    <!-- the IMA SDK -->
    <script src="//s0.2mdn.net/instream/html5/ima3.js"></script>
    <!-- your VAST plugin -->
    <script
        src="//releases.flowplayer.org/vast/vast.min.js">
    </script>


    <!-- Streamroot plugin -->
      <script src="//cdn.streamroot.io/flowplayer-hls-dna-plugin/1/stable/flowplayer-hls-dna-plugin.js#streamrootKey=151e5169-641f-40d8-b33f-7ee571e1c055"></script>

</head>

<body>
        <noscript>You need to enable JavaScript to run this app.</noscript>
        <div id="root"></div>

        <div id="vast" class="flowplayer">
            <script>
            flowplayer.conf.adaptiveRatio = true;
            window.player = flowplayer

            flowplayer.conf.hlsjs = {
            maxBufferSize: 0,
            maxBufferLength: 30,
            liveSyncDuration: 30
            };



            flowplayer.conf.dnaConfig = {};

            window.onload = function () {

                flowplayer("#vast", {
                // configure the VAST plugin for this player
                ima: {
                    // adverts configuration
                    ads: [{
                    // mandatory: schedule ad time
                    // here: 0 seconds into the video
                    time: 0,
                    // request an advert with an adTag URL
                    adTag: "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator="
                    },
                    {
                    // mandatory: schedule ad time
                    // here: 20 seconds into the video
                    time: 1800,
                    // request an advert with an adTag URL
                    adTag: "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator="
                    }
                    ] 
                }, 

                key: "$00",
                splash: true,
                live: true,
                share: false,
                ratio: 2 / 4,

                clip: {
                    sources: [
                    { type: "application/x-mpegurl",
                        src:  "https:/manifest.m3u8" }
                    ]
                }
            })
        };

     </script>

    </div>
    </div>


</body>

</html>

player.js //反应组件

   handlePlay = () => {

    if(this.props.showPlay == 'block'){
        const player = window.flowplayer(`#vast`)
        player.load();
    } else {
        const player = window.flowplayer(`#vast`)
        player.pause();
    }
}

0 个答案:

没有答案