Drkcore

23 10 2011 HTML5 Tweet

HTML5 CANVAS 6-7

videoタグじゃなくてcanvas経由で動画を表示する。

HTML5 6-7

videoElement = document.createElement('video')
videoDiv = document.createElement('div')
document.body.appendChild(videoDiv)
videoDiv.appendChild(videoElement)
videoDiv.setAttribute("style","display:none;")
videoType = supportedVideoFormat(videoElement)

console.log(videoType)
videoElement.setAttribute("src","/videos/sample." + videoType)
videoElement.addEventListener("canplaythrough", videoLoaded, false)

theCanvas = document.getElementById("canvasOne")
context = theCanvas.getContext("2d")

videoElement.play()
setInterval(drawScreen, 33)

なんでvideoElementにイベントリスナー設定しているのに、最後の方でplayメソッドを呼び出しているのかわからん。6-5のサンプルに倣うんだったらvideoLoadedで呼び出すべきなんじゃないのかね?

ProductName HTML5 Canvas: Native Interactivity and Animation for the Web
Steve Fulton
Oreilly & Associates Inc / 2922円 ( 2011-05-13 )


About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021