|
@@ -167,23 +167,25 @@ export default class App {
|
|
|
|
|
|
bindSocketEvents() {
|
|
bindSocketEvents() {
|
|
|
|
|
|
- // 获得旋转视频
|
|
|
|
window.connection.socket.on('getSocketVideo', async(data) => {
|
|
window.connection.socket.on('getSocketVideo', async(data) => {
|
|
|
|
|
|
console.log("[3D] getSocketVideo: ", data)
|
|
console.log("[3D] getSocketVideo: ", data)
|
|
|
|
|
|
- const blob = new Blob([data], { type: 'application/video' })
|
|
|
|
- const url = URL.createObjectURL(blob)
|
|
|
|
- // this.updateHouseVideoBlob(url, true)
|
|
|
|
- // let video = common.createVideoElement0(url)
|
|
|
|
- // video.loop = "loop"
|
|
|
|
- setTimeout(function () {
|
|
|
|
- return URL.revokeObjectURL(url)
|
|
|
|
- }, 3000)
|
|
|
|
-
|
|
|
|
if(this.getWalkVideo) {
|
|
if(this.getWalkVideo) {
|
|
-
|
|
|
|
|
|
+ // 获得行走视频
|
|
|
|
+ let dataArr = [data]
|
|
let path = this.currentPoints.map( (point, index) => {
|
|
let path = this.currentPoints.map( (point, index) => {
|
|
|
|
+
|
|
|
|
+ const blob = new Blob( dataArr.slice(
|
|
|
|
+ index / this.currentPoints.length * dataArr.length,
|
|
|
|
+ (index + 1) / this.currentPoints.length * dataArr.length
|
|
|
|
+ ), { type: 'application/video' })
|
|
|
|
+
|
|
|
|
+ const url = URL.createObjectURL(blob)
|
|
|
|
+ setTimeout(function () {
|
|
|
|
+ URL.revokeObjectURL(url)
|
|
|
|
+ }, 3000)
|
|
|
|
+
|
|
return {
|
|
return {
|
|
point: new BABYLON.Vector3(point.location.x, 0, point.location.z),
|
|
point: new BABYLON.Vector3(point.location.x, 0, point.location.z),
|
|
video: common.createVideoElement0(url)
|
|
video: common.createVideoElement0(url)
|
|
@@ -196,7 +198,40 @@ export default class App {
|
|
|
|
|
|
this.getWalkVideo = false
|
|
this.getWalkVideo = false
|
|
|
|
|
|
|
|
+ // 获得行走视频后,获取终点旋转视频
|
|
|
|
+ let endPointId = this.currentPoints[this.currentPoints.length - 1].id
|
|
|
|
+
|
|
|
|
+ console.log("[3D] send(getRotateVideo): ", endPointId + "/" + endPointId)
|
|
|
|
+ window.connection.socket.emit("getRotateVideo", {
|
|
|
|
+ videoPath: endPointId + "/" + endPointId,
|
|
|
|
+ sangle: 0,
|
|
|
|
+ eangle: 360,
|
|
|
|
+ reverses: false,
|
|
|
|
+ sceneCode: settings.sceneCode,
|
|
|
|
+ roomId: settings.roomId,
|
|
|
|
+ userId: settings.userId,
|
|
|
|
+ });
|
|
|
|
+ window.connection.socket.emit("getRotateVideo", {
|
|
|
|
+ videoPath: endPointId + "/" + endPointId,
|
|
|
|
+ sangle: 0,
|
|
|
|
+ eangle: 360,
|
|
|
|
+ reverses: true,
|
|
|
|
+ sceneCode: settings.sceneCode,
|
|
|
|
+ roomId: settings.roomId,
|
|
|
|
+ userId: settings.userId,
|
|
|
|
+ });
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
|
|
+ // 获得旋转视频
|
|
|
|
+ const blob = new Blob([data], { type: 'application/video' })
|
|
|
|
+ const url = URL.createObjectURL(blob)
|
|
|
|
+ // this.updateHouseVideoBlob(url, true)
|
|
|
|
+ // let video = common.createVideoElement0(url)
|
|
|
|
+ // video.loop = "loop"
|
|
|
|
+ setTimeout(function () {
|
|
|
|
+ return URL.revokeObjectURL(url)
|
|
|
|
+ }, 3000)
|
|
|
|
+
|
|
// this.cameraController.rotateCamera(this.cameraController.alphaOffset)
|
|
// this.cameraController.rotateCamera(this.cameraController.alphaOffset)
|
|
|
|
|
|
if(this.isReverse) {
|
|
if(this.isReverse) {
|
|
@@ -210,20 +245,20 @@ export default class App {
|
|
if(this.initVideo) {
|
|
if(this.initVideo) {
|
|
this.updateHouseVideoBlob(url, true)
|
|
this.updateHouseVideoBlob(url, true)
|
|
this.initVideo = false
|
|
this.initVideo = false
|
|
|
|
+ this.cameraController.camera.minZ = 0.001
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
- // 获得行走视频
|
|
|
|
window.connection.socket.on('getVideo', async (data) => {
|
|
window.connection.socket.on('getVideo', async (data) => {
|
|
|
|
|
|
console.log("[3D] getVideo: ", data)
|
|
console.log("[3D] getVideo: ", data)
|
|
|
|
|
|
- const blob = new Blob([data], { type: 'application/video' })
|
|
|
|
- const url = URL.createObjectURL(blob)
|
|
|
|
- setTimeout(function () {
|
|
|
|
- URL.revokeObjectURL(url)
|
|
|
|
- }, 3000)
|
|
|
|
|
|
+ // const blob = new Blob([data], { type: 'application/video' })
|
|
|
|
+ // const url = URL.createObjectURL(blob)
|
|
|
|
+ // setTimeout(function () {
|
|
|
|
+ // URL.revokeObjectURL(url)
|
|
|
|
+ // }, 3000)
|
|
|
|
|
|
// let path = this.currentPoints.map( (point, index) => {
|
|
// let path = this.currentPoints.map( (point, index) => {
|
|
// return {
|
|
// return {
|
|
@@ -255,12 +290,14 @@ export default class App {
|
|
}
|
|
}
|
|
|
|
|
|
this.getWalkVideo = true
|
|
this.getWalkVideo = true
|
|
- connection.socket.emit("getVideo", {
|
|
|
|
|
|
+ let sendData = {
|
|
videoList: videos,
|
|
videoList: videos,
|
|
sceneCode: settings.sceneCode,
|
|
sceneCode: settings.sceneCode,
|
|
roomId: settings.roomId,
|
|
roomId: settings.roomId,
|
|
userId: settings.userId,
|
|
userId: settings.userId,
|
|
- });
|
|
|
|
|
|
+ }
|
|
|
|
+ console.log("[3D] send(getVideo): ", sendData);
|
|
|
|
+ connection.socket.emit("getVideo", sendData);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
@@ -280,7 +317,6 @@ export default class App {
|
|
mesh.material && mesh.material.setTexture("texture_video", videoTexture)
|
|
mesh.material && mesh.material.setTexture("texture_video", videoTexture)
|
|
})
|
|
})
|
|
!notPlay && video.play()
|
|
!notPlay && video.play()
|
|
- return video
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|