123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- Component({
- properties: {
- title: {
- type: String,
- value: '',
- },
- intro: {
- type: String,
- value: '',
- },
- hint: {
- type: String,
- value: '',
- },
- code: {
- type: String,
- value: '',
- },
- json: {
- type: String,
- value: '',
- },
- js: {
- type: String,
- value: '',
- },
- showBackBtn: {
- type: Boolean,
- value: false,
- },
- recordState: 0,
- },
- data: {
- },
- lifetimes: {
- attached() {
- wx.xrTitle = this.data.title;
- }
- },
- captureQuality: {
- type: Number,
- value: 0.8,
- },
- captureType: {
- type: String,
- value: 'jpg',
- },
- recordFPS: {
- type: Number,
- value: 30,
- },
- methods: {
- recordStart() {
- console.log('recordStart')
- wx.updateShareMenu({
- withShareTicket: true,
- success () { }
- })
- this.scene.share.recordStart({
- fps: 15,
- videoBitsPerSecond: 10000,
- });
- },
- recordEnd() {
- console.log('recordEnd')
- const tempFilePath = this.scene.share.recordFinishToAlbum({
- fps: 15,
- videoBitsPerSecond: 10000,
- });
- wx.shareVideoMessage({
- videoPath: tempFilePath,
- });
- },
- onClickBack() {
- wx.navigateBack()
- },
- /**
- * 获取系统信息 设置相机的大小适应屏幕
- */
- setCameraSize() {
- //获取设备信息
- const res = wx.getSystemSetting();
- //获取屏幕的可使用宽高,设置给相机
- this.setData({
- cameraHeight: res.windowHeight,
- cameraWidth: res.windowWidth
- })
- console.log(res)
- },
-
-
- /**
- * 开始录像的方法
- */
- startShootVideo() {
-
- console.log("========= 调用开始录像 ===========")
- this.ctx.startRecord({
- success: (res) => {
- wx.showLoading({
- title: '正在录像',
- })
- },
- fail() {
- console.log("========= 调用开始录像失败 ===========")
- }
- })
- },
-
- /**
- * 结束录像
- */
- stopShootVideo() {
-
- console.log("========= 调用结束录像 ===========")
- this.ctx.stopRecord({
- success: (res) => {
- wx.hideLoading();
- this.setData({
- videoSrc: res.tempVideoPath,
- })
- },
- fail() {
- wx.hideLoading();
- console.log("========= 调用结束录像失败 ===========")
- }
- })
- }
- },
- options: {
- multipleSlots: true
- }
- })
|