123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- const app = getApp();
- var url = app.globalData.url;
- Component({
- behaviors: [require('../../../common/share-behavior').default],
- properties: {
- markerImg: {
- type: String
- },recordState: {
- type: Number,
- value: 0,
- observer: function (newVal, oldVal) {
- if (newVal !== oldVal) {
- if (newVal === 1) {
- this.recordStart();
- } else if (newVal === 2) {
- this.recordEnd();
- }
- }
- }
- },captureState: {
- type: Number,
- value: 0,
- observer: function (newVal, oldVal) {
- console.log("observer===>"+newVal);
- this.capture();
- }
- },
- },
- data: {
- loaded: false,
- arReady: false,
- loadedSaoMiao:false,
- ar_2img:url+"targets/ar_2.png",
- baseurl:url,
- },
-
- lifetimes: {
- attached() {
- console.log('data', this.data)
- }
- },
- methods: {
- handleReady({
- detail
- }) {
- const xrScene = this.scene = detail.value;
- console.log('xr-scene', xrScene);
- },
- handleAssetsProgress: function ({
- detail
- }) {
- console.log('assets progress', detail.value);
- },handleTrackerSwitch: function ({detail}) {
- const active = detail.value;
- if(active)
- {
- this.triggerEvent('assetsstr',true);
-
- this.setData({loadedSaoMiao: true});
- // this.scene.share.captureToFriends();
- }
- },handleARTrackerState({detail}) {
- },
- handleAnimationStop: function() {
- console.log('animation Stop');
- },
- handleAssetsLoaded: function ({
- detail
- }) {
- console.log('assets loaded', detail.value);
- this.setData({
- loaded: true
- });
- },
- handleARReady: function ({
- detail
- }) {
- console.log('arReady');
- this.setData({
- arReady: true
- })
- },
- capture: function () {
- this.scene.share.captureToFriends({
- fileType: this.data.captureType,
- quality: this.data.captureQuality
- });
- },
- 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,
- });
- wx.showToast({
- title: '视频已经保存至相册',
- });
- }
- }
- })
|