|
@@ -52,7 +52,7 @@ export default class App {
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
- window.connection.socket.emit("getRotateVideo", {
|
|
|
+ window.connection.socket.emit("getRotateVideoUrl", {
|
|
|
videoPath: "0/0",
|
|
|
sangle: 0,
|
|
|
eangle: 360,
|
|
@@ -61,7 +61,7 @@ export default class App {
|
|
|
roomId: settings.roomId,
|
|
|
userId: settings.userId,
|
|
|
});
|
|
|
- window.connection.socket.emit("getRotateVideo", {
|
|
|
+ window.connection.socket.emit("getRotateVideoUrl", {
|
|
|
videoPath: "0/0" ,
|
|
|
sangle: 0,
|
|
|
eangle: 360,
|
|
@@ -168,7 +168,61 @@ export default class App {
|
|
|
bindSocketEvents() {
|
|
|
|
|
|
let walkPointsTemp = []
|
|
|
+ window.connection.socket.on('getRotateVideoUrl', async(data) => {
|
|
|
+ console.log("[3D] getSocketVideo: ", data)
|
|
|
+ const url = data
|
|
|
+ // 获得旋转视频
|
|
|
+
|
|
|
+ let video = this.isReverse ? document.getElementById("houseTextureReverse")
|
|
|
+ : document.getElementById("houseTexture")
|
|
|
+
|
|
|
+ video.src = url
|
|
|
+
|
|
|
+ this.isReverse = !this.isReverse
|
|
|
+
|
|
|
+ // 页面刷新后初次加载视频
|
|
|
+ if(this.initVideo) {
|
|
|
+ this.updateHouseVideo(video, true)
|
|
|
+ this.initVideo = false
|
|
|
+ this.cameraController.camera.minZ = 0.001
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ window.connection.socket.on('getVideoUrl', async(data) => {
|
|
|
+ console.log("[3D] getSocketVideo: ", data)
|
|
|
+ const url = data
|
|
|
+
|
|
|
+ if(this.getSocketVideoType == "walkPath") {
|
|
|
|
|
|
+ let dir = this.charactorManager.getVideoDirecNum()
|
|
|
+ // 获得行走视频
|
|
|
+ let path = walkPointsTemp.map( (point, i) => {
|
|
|
+ return {
|
|
|
+ id: point.id,
|
|
|
+ point: new BABYLON.Vector3(-point.location.x, 0, point.location.z),
|
|
|
+ video: i == 0 ? common.createVideoElement0(url) : null,
|
|
|
+ videoName: i != walkPointsTemp.length - 1 ? (point.id + "/" + point.id + "_" + walkPointsTemp[i+1].id + "_" + dir) : null
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ this.getSocketVideoType = "nextWalk"
|
|
|
+
|
|
|
+ // 行走时锁定camera
|
|
|
+ this.cameraController.lockCamera(true)
|
|
|
+ this.charactorManager.charactor.startWalk(path, this.charactorManager)
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(this.getSocketVideoType == "nextWalk") {
|
|
|
+
|
|
|
+ let charactor = this.charactorManager.charactor
|
|
|
+ let video = common.createVideoElement0(url) //await common.createVideoElement(url)
|
|
|
+
|
|
|
+ console.error(charactor.walkData.currentPoint+1)
|
|
|
+ charactor.walkData.pathArr[charactor.walkData.currentPoint+1].video = video
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
window.connection.socket.on('getSocketVideo', async(data) => {
|
|
|
|
|
|
console.log("[3D] getSocketVideo: ", data)
|
|
@@ -228,9 +282,9 @@ export default class App {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- window.connection.socket.on('getVideo', async (data) => {
|
|
|
+ window.connection.socket.on('getVideoUrl', async (data) => {
|
|
|
|
|
|
- console.log("[3D] getVideo: ", data)
|
|
|
+ console.log("[3D] getVideoUrl: ", data)
|
|
|
|
|
|
// const blob = new Blob([data], { type: 'application/video' })
|
|
|
// const url = URL.createObjectURL(blob)
|
|
@@ -269,8 +323,8 @@ export default class App {
|
|
|
roomId: settings.roomId,
|
|
|
userId: settings.userId,
|
|
|
}
|
|
|
- console.log("[3D] send(getVideo): ", sendData);
|
|
|
- connection.socket.emit("getVideo", sendData);
|
|
|
+ console.log("[3D] send(getVideoUrl): ", sendData);
|
|
|
+ connection.socket.emit("getVideoUrl", sendData);
|
|
|
});
|
|
|
}
|
|
|
|