(e.detail.code == -1301) { _this.camerastate = false; } }, //返回 back() { uni.navigateBack(); }, //抓拍 snapshot() { this.livePusher.snapshot({ success: e => { _this.snapshotsrc = e.message.tempImagePath; console.log(_this.snapshotsrc) _this.stopPreview(); _this.set...
水印相机实现有两种方式,在小程序端可以用<camera>来实现,但在安卓端不支持camera,使用uniapp的<live-pusher/>来实现相机。 live-pusher推荐使用nvue来做,好处是 nvue也可一套代码编译多端。 nvue的cover-view比vue的cover-view更强大,在视频上绘制元素更容易。如果只考虑App端的话,不用cover-view,任意组件都可以...
this.livePusher.stopPreview({ success: a => { _this.camerastate = false; //标记相机未启动 } }); }, //状态 statechange(e) { //状态改变 console.log(e); if (e.detail.code == 1007) { _this.camerastate = true; } else if (e.detail.code == -1301) { _this.camerastate = fals...
(e.detail.code == -1301) { _this.camerastate = false; } }, //返回 back() { uni.navigateBack(); }, //抓拍 snapshot() { this.livePusher.snapshot({ success: e => { _this.snapshotsrc = e.message.tempImagePath; _this.stopPreview(); _this.setImage(); uni.navigateBack(); } ...
this.livePusher.stopPreview({ success: a => { _this.camerastate = false; } }); }, //状态 statechange(e) { //状态改变 console.log(e); if (e.detail.code == 1007) { _this.camerastate = true; } else if (e.detail.code == -1301) { _this.camerastate = false; } }, //返回...
利用livePusher实现 实现自定义相机 拓展性挺强的,可以实现自定义水印、身份证拍摄、人像拍摄等 这里我简单实现一个相机功能主要用于解决闪退 Tip:这里需要创建nvue文件哦~ 创建camera.nvue <template> <view class="pengke-camera" :style="{ width: windowWidth, height: windowHeight }"> ...
请检查推流地址的合法性或防盗链有效期 * @desc 3005 RTMP 读/写失败 */ export type LivePusherCode = | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | -1301 | -1302 | -1303 | -1304 | -1305 | -1306 | -1307 | -1308 | -1309 | -1310 | -1311 | -1312 | 1101 |...
},//停止预览stopPreview() {this.livePusher.stopPreview({success:a=>{ _this.camerastate=false; } }); },//状态statechange(e) {//状态改变console.log(e);if(e.detail.code==1007) { _this.camerastate=true; }elseif(e.detail.code== -1301) { ...
this.livePusher.stopPreview({ success: a => { _this.camerastate = false; } }); }, //状态 statechange(e) { //状态改变 console.log(e); if (e.detail.code == 1007) { _this.camerastate = true; } else if (e.detail.code == -1301) { ...
拍照:1.APP端使用直播流 模拟相机窗口。需要在manifest.json -> APP权限模块里勾选 LivePusher直播流 2.小程序端只用组件模拟相机窗口。 裁剪:1.APP端无法使用canvas的API,因为用的是nvue文件,目前不支持官方canvas的API,可以使用官方提供的gcanvas的API。(gcanvas的drawImage不允许临时路径) ...