VideoLayer

我们可以通过视频图层来加载视频。视频图层包含一个layer.player对象,它是用来控制视频的。浏览器支持很多种视频,包括带有alpha通道的动画解码。

A videoLayer loads a video. VideoLayers have a layer.player object to control the video. The browser supports many different types of video, including the Animation codec that supports alpha channels.

videoLayer.video <string>

给视频图层设置播放源。

Sets the video URL for the video layer.

  1. # 创建时设置
  2. layerA = new VideoLayer
  3. video: "hello.mp4"
  4. # 创建后改变
  5. layerA.video = "bye.mp4"

videoLayer.player <object>

视频播放器的播放器对象。通过这个对象你可以控制视频,还可以监听视频播放、暂停等事件,点击这里查看所有支持的方法和属性。

Player object for the video layer. Allows you to control the video and listen for playback events. See this overview of all video methods and properties.

  1. # 创建时设置播放源
  2. layerA = new VideoLayer
  3. video: "hello.mp4"
  4. # 允许自动播放
  5. layerA.player.autoplay = true
  6. # 播放视频
  7. layerA.player.play()
  8. # 跳到第 5 秒
  9. layerA.player.fastSeek(5)
  10. # 监听暂停事件
  11. Events.wrap(layerA.player).on "pause", ->
  12. print "Video paused"