VideoContext.sendDanmu
2020-08-26 16:32 更新
解释:发送弹幕。
方法参数
Object object
object 参数说明
| 参数名 | 类型 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|---|
text | String | 否 | 弹幕文字 | |
color | String | 否 | 弹幕颜色 |
示例

图片示例

代码示例
<view class="wrap">
<video id="myVideo" enable-danmu="true" src="https://b.bdstatic.com/miniapp/development_tool/Smartprogram.mp4" rel="external nofollow" ></video>
<button type="primary" bindtap="sendDanmu">sendDanmu</button>
</view>
Page({
onLoad() {
this.videoContext = swan.createVideoContext('myVideo');
this.videoContext.play();
},
sendDanmu() {
this.videoContext.sendDanmu({
text: '这是一条弹幕',
color: '#f60'
});
}
});以上内容是否对您有帮助:

免费 AI IDE


更多建议: