0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

YoutubePlayerAPIで一つの動画をループ

Posted at

1,2年くらい前に使ったときは違ったかも?と思ったのでメモ。

この間、YoutubePlayerAPIでサイトの背景として動画をループさせたい時がありました。

YT.Playerのインスタンスを作る際に、 playerVarsに loop: 1 を指定すれば動くと思っていたらループしてくれなかったのでよくよくドキュメントを読んでみたらplaylistにもvideoIDの指定が必要でした。

const player = new YT.Player(elementID, {
  width: 640,
  height: 480,
  videoID: videoID, // 動画のID
  playerVars: {
    loop: 1,
    playlist: videoID // playlistにもvideoIDと同じ動画のIDを指定
  }
});

YouTube 埋め込みプレーヤーとプレーヤーのパラメータ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?