|
@@ -35,6 +35,7 @@ Component({
|
|
|
data: {
|
|
|
loaded: false,
|
|
|
isStartPlay1: false,
|
|
|
+ isStartAudioPlay1: false,
|
|
|
isStartPlay2: false,
|
|
|
isStartPlay3: false,
|
|
|
},
|
|
@@ -54,6 +55,22 @@ Component({
|
|
|
useWebAudioImplement: false // 是否使用 WebAudio 作为底层音频驱动,默认关闭。对于短音频、播放频繁的音频建议开启此选项,开启后将获得更优的性能表现。由于开启此选项后也会带来一定的内存增长,因此对于长音频建议关闭此选项
|
|
|
})
|
|
|
this.innerAudioContext1.src = 'https://houseoss.4dkankan.com/mini-ar-test/AR/01/audio1.MP3'
|
|
|
+ this.innerAudioContext1.onPlay = () => {
|
|
|
+ this.setData({
|
|
|
+ isStartAudioPlay1: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.innerAudioContext1.onPause = () => {
|
|
|
+ this.setData({
|
|
|
+ isStartAudioPlay1: false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.innerAudioContext1.onEnded = () => {
|
|
|
+ this.setData({
|
|
|
+ isStartAudioPlay1: false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ console.log('this.innerAudioContext1', this.innerAudioContext1)
|
|
|
|
|
|
},
|
|
|
handleARReady() {
|
|
@@ -103,20 +120,30 @@ Component({
|
|
|
this.animator1 = animator
|
|
|
// getPrimitivesByNodeName
|
|
|
const othergltf = this.scene.assets.getAsset("gltf", "item1")
|
|
|
- console.error('meshes', gltf.meshes)
|
|
|
- console.log('11', gltf.getPrimitivesByMeshName('mesh_video_16024video1'))
|
|
|
- const vm1 = gltf.getPrimitivesByMeshName('mesh_video_16024video1')
|
|
|
- vm1.material = newMat
|
|
|
- // console.error('othergltf', othergltf)
|
|
|
- for (const mesh of gltf.meshes) {
|
|
|
- console.log(mesh._el._id)
|
|
|
-
|
|
|
- //
|
|
|
+ // console.error('meshes', gltf.meshes)
|
|
|
+
|
|
|
+ // mesh_video01_16054map
|
|
|
+ // mesh_video_16024video1
|
|
|
+ // mesh_video02_16030video2
|
|
|
+
|
|
|
+ console.log('1', gltf.getPrimitivesByMeshName('mesh_video_16024video1'))
|
|
|
+ console.log('2', gltf.getPrimitivesByMeshName('mesh_video02_16030video2'))
|
|
|
+
|
|
|
+ console.error('othergltf', othergltf)
|
|
|
+ for (const mesh of othergltf.model.meshes) {
|
|
|
+ // mesh.material = newMat
|
|
|
+ console.warn('mesh', mesh.name)
|
|
|
+ }
|
|
|
+
|
|
|
+ for (const mesh of gltf.getPrimitivesByNodeName('node_video1_-1630')) {
|
|
|
+ mesh.material = newMat
|
|
|
+ console.warn('mesh1', mesh)
|
|
|
}
|
|
|
- // for (const mesh of gltf.getPrimitivesByMeshName("video2")) {
|
|
|
- // console.error('2有video2')
|
|
|
- // mesh.material = newMat2
|
|
|
- // }
|
|
|
+ for (const mesh of gltf.getPrimitivesByNodeName('node_video2_-1646')) {
|
|
|
+ mesh.material = newMat2
|
|
|
+ console.warn('mesh2', mesh)
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
handleItem2Loaded({
|
|
|
detail
|
|
@@ -148,9 +175,9 @@ Component({
|
|
|
if (type === 1) {
|
|
|
console.warn('play 1')
|
|
|
if (this.video1) {
|
|
|
- // this.data.isStartPlay1 ? this.video1.resume() : this.video1.play()
|
|
|
- // this.data.isStartPlay1 ? this.innerAudioContext1.resume() : this.innerAudioContext1.play()
|
|
|
- this.video1.play()
|
|
|
+ this.data.isStartPlay1 ? this.video1.resume() : this.video1.play()
|
|
|
+ // this.data.isStartAudioPlay1 ? this.innerAudioContext1.resume() : this.innerAudioContext1.play()
|
|
|
+
|
|
|
}
|
|
|
if (this.animator1) {
|
|
|
// this.data.isStartPlay1 ? this.animator1.resume('dd') : this.animator1.play('dd')
|
|
@@ -200,9 +227,9 @@ Component({
|
|
|
if (type === 1) {
|
|
|
console.warn('pause 1')
|
|
|
|
|
|
- // if (this.video1) {
|
|
|
- // this.video1.pause()
|
|
|
- // }
|
|
|
+ if (this.innerAudioContext1 && this.data.isStartAudioPlay1) {
|
|
|
+ this.innerAudioContext1.pause()
|
|
|
+ }
|
|
|
// if (this.animator1) {
|
|
|
// this.animator1.pause('Animation')
|
|
|
// }
|