index.js 932 B

12345678910111213141516171819202122232425262728293031323334353637
  1. Component({
  2. behaviors: [require('../common/share-behavior').default],
  3. properties: {
  4. a: Number,
  5. },
  6. data: {
  7. loaded: false
  8. },
  9. lifetimes: {},
  10. methods: {
  11. handleReady({detail}) {
  12. const xrScene = this.scene = detail.value;
  13. console.log('xr-scene', xrScene);
  14. },
  15. handleAssetsProgress: function({detail}) {
  16. console.log('assets progress', detail.value);
  17. },
  18. handleAssetsLoaded: function({detail}) {
  19. console.log('assets loaded', detail.value);
  20. this.setData({loaded: true});
  21. },
  22. handleTouchCube: async function() {
  23. const xrSystem = wx.getXrFrameSystem();
  24. const video = this.scene.assets.getAsset('video-texture', 'cat');
  25. if (!video) {
  26. return;
  27. }
  28. if (video.state === xrSystem.EVideoState.Playing) {
  29. video.pause();
  30. } else if (video.state === xrSystem.EVideoState.Paused) {
  31. video.resume();
  32. }
  33. }
  34. }
  35. })