tt.enableUserScreenRecord

更新时间 2024-07-24 02:58:49
收藏
我的收藏

基础库 2.7.0 开始支持本方法,这是一个异步方法。

调用该 API 可以取消禁止用户录屏,iOS 从基础库 2.98.0 开始支持 tt.enableUserScreenRecord。

前提条件
业务背景
使用限制
注意事项
建议退出不希望用户录制的页面之后,再调用 enableUserScreenRecord 恢复录屏能力。
支持沙盒
相关教程

语法

tt.enableUserScreenRecord(options)

参数说明

options 为 object 类型,属性如下:

属性名类型默认值必填说明最低支持版本
successfunction
接口调用成功的回调函数
2.7.0
failfunction
接口调用失败的回调函数
2.7.0
completefunction
接口调用结束的回调函数(调用成功、失败都会执行)
2.7.0

回调成功

object 类型,属性如下:

属性名类型说明最低支持版本
errMsgstring
"enableUserScreenRecord:ok"
2.7.0

回调失败

object 类型,属性如下:

属性名类型说明最低支持版本
errMsgstring
"enableUserScreenRecord:fail" + 详细错误信息
2.7.0

扫码体验

请使用字节宿主APP扫码

代码示例

开发者工具中预览

tt.enableUserScreenRecord({
  success(res) {
    console.log("enableUserScreenRecord 调用成功", res);
    tt.showToast({
      title: "取消禁止录屏成功",
      duration: 2000,
    });
  },
  fail(res) {
    console.log("enableUserScreenRecord 调用失败", res);
  },
});