camera.wxml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <import src="../../../common/head.wxml" />
  2. <import src="../../../common/foot.wxml" />
  3. <view class="container page" data-weui-theme="{{theme}}">
  4. <template is="head" data="{{title: 'camera'}}"/>
  5. <view class="page-body">
  6. <view class="page-body-wrapper">
  7. <view style="margin-bottom: 10px"> camera 组件 </view>
  8. <camera
  9. flash="off"
  10. device-position="{{position}}"
  11. binderror="error"
  12. >
  13. </camera>
  14. <view wx:if="{{showCanvas}}" class="info-container">
  15. <view style="margin: 10px 0">使用实时数据帧在 canvas 组件的展示</view>
  16. <view>
  17. 帧高度:{{ frameHeight }} 帧宽度:{{ frameWidth }}
  18. </view>
  19. <canvas
  20. id="webgl"
  21. type="webgl"
  22. canvas-id="canvas"
  23. style="width: {{width}}px; height: {{height}}px;"
  24. >
  25. </canvas>
  26. </view>
  27. <view class="btn-area first-btn">
  28. <button bindtap="handleShowCanvas" type="primary">{{showCanvas ? "关闭实时帧数据模式": "开启实时帧数据模式"}}</button>
  29. </view>
  30. <view class="btn-area">
  31. <button type="primary" bindtap="togglePosition">切换摄像头</button>
  32. </view>
  33. <view class="btn-area">
  34. <button type="primary" bindtap="takePhoto">拍照</button>
  35. </view>
  36. <view class="btn-area">
  37. <button type="primary" bindtap="startRecord">开始录像</button>
  38. </view>
  39. <view class="btn-area">
  40. <button type="primary" bindtap="stopRecord">结束录像</button>
  41. </view>
  42. <view class="btn-area">
  43. <navigator url="/packageComponent/pages/media/camera-scan-code/camera-scan-code" hover-class="none">
  44. <button type="primary">扫描一维码</button>
  45. </navigator>
  46. </view>
  47. <view class="preview-tips">点击录像或拍照即可在下方预览效果</view>
  48. <image wx:if="{{src}}" mode="widthFix" class="photo" src="{{src}}"></image>
  49. <video wx:if="{{videoSrc}}" class="video" src="{{videoSrc}}"></video>
  50. </view>
  51. </view>
  52. <template is="foot" />
  53. </view>