dongxiongshi9952 2012-03-25 06:42
浏览 54

根据标签播放随机YouTube视频

Does anybody know a quick way for a script to play YouTube videos randomly by just entering in a tag from a web form? Trying to build it using PHP and JavaScript, wouldn't know where to begin using the YouTube API.

  • 写回答

1条回答 默认 最新

  • doudan5136 2012-03-25 06:50
    关注

    The setShuffle function instructs YouTube to play the videos in the playlist in random order (or to play them in their designated order.

    player.setShuffle(shufflePlaylist:Boolean):Void
    

    This function indicates whether a playlist's videos should be shuffled so that they play back in an order different from the one that the playlist creator designated. If you shuffle a playlist after it has already started playing, the list will be reordered while the video that is playing continues to play. The next video that plays will then be selected based on the reordered list.   This setting will not persist if you load or cue a different playlist, which means that if you load a playlist, call the setShuffle function, and then load a second playlist, the second playlist will not be shuffled.  

    • The required shufflePlaylist parameter indicates whether YouTube should shuffle the playlist.  
      • If the parameter value is true, then YouTube will shuffle the playlist order. If you instruct the function to shuffle a playlist that has already been shuffled, YouTube will shuffle the order again.  
      • If the parameter value is false, then YouTube will change the playlist order back to its original order.

    click here to learn how to use YouTube JavaScript Player API Reference

    评论

报告相同问题?

悬赏问题

  • ¥15 求帮我调试一下freefem代码
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图