2011/12/05

[YouTube][JavaScript]ある一定のところから再生

タイトル通りになってしまうのだが、JavaScriptから、YouTubeのある一定のところからスタートさせる方法について調査をしました。

Playback controls and player settingsを読むと、player.seekTo(seconds:Number, allowSeekAhead:Boolean):Voidメソッドを使えば、できるようだ。

第一引数は、何秒目からスタートさせるのか?という設定を行なうので楽なのだが、問題は、第二引数。

allowSeekAheadとはいったい?

The allowSeekAhead parameter determines whether the player will make a new request to the server if the seconds parameter specifies a time outside of the currently buffered video data. We recommend that you set this parameter to false while the user is dragging the mouse along a video progress bar and then set the parameter to true when the user releases the mouse.

via:player.seekTo(seconds:Number, allowSeekAhead:Boolean):Void
つまり、サーバー側に問い合わせを行なうかどうかを設定するところ。

trueなら行なう、falseなら問い合わせを行なわない。

上記の文面から、プログレスバーをいじっている間は、falseで、それ以外は、trueを推奨しているとのこと。

確かに理解は、できるが、そもそも、プログレスバーをいじっているかどうかって、どこで判断するのだろうか?

onStateChangeメソッドじゃーないしなー。

うーん、困った。困った><

0 コメント:

コメントを投稿