- JS API 列表
- 基础
- 网络
- 媒体
- 地图
- 文件
- 开放接口
- 数据缓存
- 地理位置
- 设备
- 画布
- 界面
- 页面导航
- 侧边栏能力
- 行业开放
- AI/AR能力
- 第三方平台
- TTML
- 转发和挂载
- 其它
- 直播能力
EffectCameraStream.offError收藏我的收藏
收藏
我的收藏语法
Plain Text复制EffectCameraStream.offError(callback)
参数说明
function callback
回调参数
无
代码示例
预期表现:连续点击【打开相机】,弹出错误提示。
点击【取消错误监听】后,再次重复点击【打开相机】,不出现错误提示。
html复制<button type="primary" bindtap="requestEffectCamera">打开相机</button>
<button type="primary" bindtap="offError">取消错误监听</button>
js复制Page({
onShow: function (options) {
this.effectCameraStream = tt.createEffectCameraStream(this);
this.effectCameraStream.onError(this.onError);
this.effectCameraStream.onRequest(this.onRequest);
},
requestEffectCamera() {
this.effectCameraStream.request({
orientation: "front",
});
},
onError(error) {
console.log("onError", error);
const { type, errMsg } = error;
tt.showModal({
title: `onError ${type}`,
content: errMsg,
});
},
offError() {
tt.showToast({
title: "取消错误监听",
});
this.effectCameraStream.offError(this.onError);
},
onRequest() {
tt.showModal({
title: "相机资源申请成功",
});
},
});
Bug & Tip
暂无。
点击纠错