onError事件处理程序返回event.data = 0,通常用于已移除或私有的视频(尽管我尚未测试所有案例),而不是YouTube IFrame API参考(https://developers.google)上记录的错误值. com/youtube/iframe_api_reference#Events)
onerror的
如果播放器中发生错误,则会触发此事件.API将事件对象传递给事件侦听器函数.该对象的data属性将指定一个整数,用于标识发生的错误类型.可能的值是:
Run Code Online (Sandbox Code Playgroud)2 – The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks. 5 – The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred. 100 – The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private. 101 – The owner of the requested video does not allow it to be played in embedded players. 150 – This error is the same as 101. It's just a 101 error in disguise!
这种情况发生在Mac OS X,Chrome,Firefox和Safari等最新版本中.以下链接指向已删除的视频,该视频在使用IFrame API嵌入时会返回此错误代码:http://www.youtube.com/watch?v = -TefH2gu9-o
在Player API演示中测试此视频也返回0(对于AS3播放器;选择IFrame时,它返回[object Object]并且不可检查).
预期的错误代码为100或更高.
当视频id“-TefH2gu9-o”使用HTML5播放时,返回错误代码100,但是,使用Flash播放时,错误返回0。我将与内部工程团队跟进此事。
关于:
鉴于这是现在报告 YouTube API 这些问题的唯一方法......
我们非常鼓励人们使用公共问题跟踪器来报告与 YouTube API 相关的错误,并且只在 Stack Overflow 上提出编程/技术问题(与 Stack Overflow 的更大使命保持一致)。有关如何报告错误/功能请求的详细信息,请访问http://apiblog.youtube.com/2012/09/the-youtube-api-on-stack-overflow.html
| 归档时间: |
|
| 查看次数: |
1434 次 |
| 最近记录: |