后浪云百度小程序教程:swan.createCameraContext

  • swan.createCameraContext
    • 方法参数
      • 返回值
    • 示例
      • 图片示例
      • 代码示例

    swan.createCameraContext

    解释:创建并返回 camera 上下文 cameraContext对象,cameraContext 与页面的 camera 组件绑定,一个页面只能有一个 camera,通过它可以操作对应的组件。使用该 API 需通过获取用户授权设置申请授权后方可对用户发起授权申请,可在 swan.authorize 中查看相关错误码信息。
    Web 态说明:Web 态暂不支持相机功能。createCameraContext 返回的 CameraContext 系列方法,在 Web 态会做 打开百度 App 对应小程序页面 的降级处理。

    方法参数

    返回值

    CameraContext

    示例

    跳转编辑工具

    在开发者工具中打开

    在 WEB IDE 中打开

    扫码体验

    代码示例

    后浪云百度小程序教程:swan.createCameraContext插图

    请使用百度APP扫码

    图片示例

    后浪云百度小程序教程:swan.createCameraContext插图1

    代码示例

    • SWAN
    • JS
     
     
     
    1. <view class="wrap">
    2. <view class="card-area">
    3. <camera
    4. flash="off"
    5. bindstop="stop"
    6. binderror="error"
    7. style="width: 100%; height: 3rem;">
    8. </camera>
    9. </view>
    10. </view>
    THE END