swan.createAnimationVideo

解释: 创建并返回 animation-video 上下文 animationVideo 对象。通过 animationVideoId 跟一个 animation-video 组件绑定,通过它可以操作一个animation-video 组件。

方法参数

String animationVideoId

返回值

AnimationVideo

示例

在开发者工具中预览效果

扫码体验

请使用百度APP扫码

图片示例

代码示例

  1. <view class="wrap"> <animation-video id ="myAnimationVideo" path = "{{path}}" bindstarted = "started" bindended = "ended" resource-width="800" resource-height="400" canvas-style ="width: 100%" > </animation-video></view>
  1. Page({ data: { path: 'https://efe-h2.cdn.bcebos.com/ceug/resource/res/2020-1/1577964961344/003e2f0dcd81.mp4' }, onLoad() { // 创建动画组件实例 this.myAnimationVideo = swan.createAnimationVideo('myAnimationVideo'); }});