Skip to content

Instantly share code, notes, and snippets.

@Tsumio
Last active August 14, 2018 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tsumio/c64322c2e5ca75b4b71fca8ae50755b3 to your computer and use it in GitHub Desktop.
Save Tsumio/c64322c2e5ca75b4b71fca8ae50755b3 to your computer and use it in GitHub Desktop.
Play original video on the map scene.
requestAnimationFrame(() => {
//Note:何もしない。
//Note:コアスクリプトのバージョンによっては、これを呼んでおかないと音声のみの再生になる。
});
const playOriginalVideo = function() {
//テクスチャとSpriteの生成
const texture = new PIXI.Texture.fromVideo('movies/testmovie-640x360.webm');//ファイル名指定
const videoSprite = new PIXI.Sprite(texture);
//ビデオのサイズを設定
videoSprite.width = 640;
videoSprite.height = 360;
//ループを設定
texture.baseTexture.source.loop = true;
//Z座標を設定しておく
//Note:これはツクールのコアスクリプトがchildrenの順番を勝手にソートするため。
videoSprite.z = 1;
//シーンの_tilemap用コンテナにaddChildする
//Note:マップシーン以外で呼ぶとエラーを起こす
SceneManager._scene.children[0]._tilemap.addChild(videoSprite);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment