最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to control <iframe> based YouTube player? - Stack Overflow

programmeradmin1浏览0评论

YouTube allows to use <iframe> to embed videos on sites in addition to flash based way of embedding. That has advantages especially for mobile devices. .html

Unfortunatly i could not find any API documentation similar to flash based way like .html

Is it possible to control programmatically the <iframe> based player using pure JavaScript, for example playing or pausing the video?

YouTube allows to use <iframe> to embed videos on sites in addition to flash based way of embedding. That has advantages especially for mobile devices. http://apiblog.youtube./2010/07/new-way-to-embed-youtube-videos.html

Unfortunatly i could not find any API documentation similar to flash based way like http://code.google./apis/youtube/js_api_reference.html

Is it possible to control programmatically the <iframe> based player using pure JavaScript, for example playing or pausing the video?

Share Improve this question edited Jun 3, 2011 at 15:21 Lipis 21.8k20 gold badges96 silver badges121 bronze badges asked Jun 3, 2011 at 15:10 tzadortzador 2,6414 gold badges33 silver badges38 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

https://developers.google./youtube/iframe_api_reference#Operations

We support a similar set of functions for the IFrame API as are currently supported for the JavaScript API.

Please refer to that document for a list of functions. Please note that the functions that deal with video bytes behave differently when HTML5 playback is used via the IFrame API. getVideoBytesTotal is hardcoded to return 1000. getVideoBytesLoaded will return a value between 0 and 1000. To calculate the fraction of the video that has been loaded you can divide the getVideoBytesLoaded value by the getVideoBytesTotal value, and that calculation will work regardless of whether HTML5 or ActionScript 3 playback is used.

Do note it is a experimental service which should not be used for production level applications.

Notice

Important: This is an experimental feature, which means that it might change unexpectedly.

发布评论

评论列表(0)

  1. 暂无评论