前贴式广告期间YouTube的PlayerState是什么? [英] What is the YouTube's PlayerState during pre-roll ad?

查看:205
本文介绍了前贴式广告期间YouTube的PlayerState是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Flash YouTube API getPlayerState()方法有6个可能的值:


  • -1(未启动)
  • 0(已结束)
  • 1(播放)

  • 2(已暂停)
  • 3 (缓冲)

  • 5(video cued)。
  • >


    当玩家第一次加载视频时,它会播放一个未分离的
    (-1)事件。当视频被引导并准备播放时,播放器将
    播放视频提示(5)事件。在你的代码中,你可以指定
    的整数值,或者你可以使用下面的命名空间
    变量之一。



    <请考虑这一点:$ b​​
    $ ol

  • 玩家正在等待用户交互的CUED。
  • 用户点击play

  • 插播视频广告开始播放

  • 玩家状态在前贴片广告?如何知道广告正在播放?

    https://developers.google.com/youtube/youtube_player_demo =noreferrer> https://developers.google.com/youtube/youtube_player_demo




    1. onStateChange事件:玩家状态改为:-1 (未定义)
    2. cueVideoById(cggNqDAtJYU,parseInt(0),默认值);
    3. onStateChange事件:玩家状态改为:5

    4. onStateChange事件:玩家状态改为:2(已暂停)

    所以当广告播放时,视频的状态为PAUSED(2)。此外,播放视频()或pauseVideo()的电话将在预卷过程中无效。


    The Flash YouTube API getPlayerState() method has 6 possible values:

    • -1 (unstarted)
    • 0 (ended)
    • 1 (playing)
    • 2 (paused)
    • 3 (buffering)
    • 5 (video cued).

    The manual reads:

    When the player first loads a video, it will broadcast an unstarted (-1) event. When a video is cued and ready to play, the player will broadcast a video cued (5) event. In your code, you can specify the integer values or you can use one of the following namespaced variables.

    Consider this:

    1. The player is CUED waiting for user interaction.
    2. User clicks play
    3. Pre-roll video ad starts to play

    What state is the player in during the pre-roll ad? How do I know an ad is being played?

    解决方案

    I did the legwork for you at https://developers.google.com/youtube/youtube_player_demo

    Cuing a video with a preroll and then clicking Play leads to:

    1. onStateChange event: Player state changed to: "-1" (undefined)
    2. cueVideoById(cggNqDAtJYU, parseInt(0), default);
    3. onStateChange event: Player state changed to: "5" (video cued)
    4. onStateChange event: Player state changed to: "2" (paused)

    So the video's state is PAUSED (2) while the ad is playing. Additionally, calls to playVideo() or pauseVideo() will be no-ops during a preroll.

    这篇关于前贴式广告期间YouTube的PlayerState是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆