|
@@ -105,7 +105,7 @@ var settings = {
|
|
|
},
|
|
|
mobile:{
|
|
|
nav: '1k', //不放大时
|
|
|
- max: '2k', //放大最大
|
|
|
+ max: '4k', //放大最大
|
|
|
}
|
|
|
}, //可以稍后自行修改
|
|
|
}
|
|
@@ -1564,39 +1564,141 @@ function initByTHREE(THREE){
|
|
|
}
|
|
|
window.RoomLabel = RoomLabel
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /* class VideoPlayer extends THREE.EventDispatcher{
|
|
|
+ constructor(player) {
|
|
|
+ super()
|
|
|
+ this.instances = new Map()
|
|
|
+ this.isFlv = false
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ addVideo(src) {
|
|
|
+ let video = this._createVideo(src)
|
|
|
+ this.instances.set(src, video)
|
|
|
+ return video
|
|
|
+ }
|
|
|
|
|
|
+ getVideo(src) {
|
|
|
+ let video = this.instances.get(src)
|
|
|
|
|
|
- let f = ()=>{
|
|
|
- window.bus.removeEventListener('playerAndModelReady',f)
|
|
|
-
|
|
|
- player.on("mode.changing",(currentMode, mode, pano, duration)=>{
|
|
|
- let noLine = mode == 'floorplan';
|
|
|
- if(noLine){
|
|
|
- $('.widgets-doll-labels').addClass('noLine').addClass('noCorner')
|
|
|
- }else{
|
|
|
- $('.widgets-doll-labels').removeClass('noLine').removeClass('noCorner')
|
|
|
- }
|
|
|
- })
|
|
|
+ if (!video) {
|
|
|
+ video = this.addVideo(src)
|
|
|
+ }
|
|
|
+
|
|
|
+ return video
|
|
|
+ }
|
|
|
+
|
|
|
+ _createVideo(src) {
|
|
|
+ let video = document.createElement('video')
|
|
|
+ video.setAttribute('crossOrigin', 'anonymous')
|
|
|
+ video.setAttribute('playsinline', 'true')
|
|
|
+ video.setAttribute('x5-playsinline', 'true')
|
|
|
+ video.setAttribute('webkit-playsinline', 'true')
|
|
|
+ video.setAttribute('x5-video-player-type', 'h5')
|
|
|
+ video.setAttribute('controls', 'true')
|
|
|
+ video.setAttribute('controlslist', 'nodownload')
|
|
|
+ video.setAttribute('preload', 'meta') //注意,src赋值就会自动加载, preload="meta" 只加载元数据,提高加载速度,否则一开始卡
|
|
|
+
|
|
|
+ video.autoplay = false
|
|
|
+ video.muted = true
|
|
|
+ video.loop = true
|
|
|
+ video.style.position = 'fixed'
|
|
|
+ video.style.left = '0'
|
|
|
+ video.style.top = '0'
|
|
|
+ video.style.zIndex = '1000'
|
|
|
+ video.style.width = '200px'
|
|
|
+ video.style.display = 'none'
|
|
|
+ //document.body.appendChild(video)
|
|
|
+ //video.style.display = browser.urlHasValue('debug') ? 'block' : 'none'
|
|
|
+ video.src = src
|
|
|
+
|
|
|
+ if(this.isFlv) this.attachFlv(video)
|
|
|
+
|
|
|
+ return video
|
|
|
+ }
|
|
|
+
|
|
|
+ attachFlv(video){ 四维看看的会把视频转码成flv和mp4存在服务器, 但是大场景不会,所以安卓(如vivo)加载不了。flv必须用flvjs播放,且苹果有的支持不了
|
|
|
+ if(video.flvjsPlayer)return
|
|
|
+ let player = flvjs.createPlayer({ type: 'flv', url: video.src }) //需要是flv格式才行
|
|
|
+ player.videoElement = video
|
|
|
+ player.attachMediaElement(video)
|
|
|
+ player.on(flvjs.Events.ERROR, this._onPlayerError.bind(this))
|
|
|
+ player.load()
|
|
|
+ video.flvjsPlayer = player;
|
|
|
+ }
|
|
|
+
|
|
|
+ _onPlayerError() {
|
|
|
+ console.warn('视频加载失败')
|
|
|
+ }
|
|
|
|
|
|
+ changeTypeToFlv(){
|
|
|
+ this.isFlv = true
|
|
|
+ for(let [key,value] of this.instances){
|
|
|
+ this.attachFlv(value)
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- player.on("view.changed",(e)=>{
|
|
|
- if(e.cameraChanged){
|
|
|
- //if(needUpdateZIndex){ //如果某个label显示时需要更新index的话,加个参数
|
|
|
- let label_ = labels.filter(e=>e.elem[0].style.display == 'block')
|
|
|
- label_.sort((a,b)=>b.pos2d.z - a.pos2d.z)
|
|
|
- label_.forEach((e,index)=>e.elem.css('z-index', index+1000));
|
|
|
-
|
|
|
- //}
|
|
|
- }
|
|
|
- })
|
|
|
|
|
|
- player.model.hotGroup.children.length ? logSth() : player.on('gotHotAndStartload',logSth)
|
|
|
- }
|
|
|
- window.bus.addEventListener('playerAndModelReady',f) //player model currentPano都已有
|
|
|
-
|
|
|
- window.bus.dispatchEvent({type: 'THREE_inited'})
|
|
|
+ } */
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ {
|
|
|
+ let f = ()=>{
|
|
|
+ window.bus.removeEventListener('playerAndModelReady',f)
|
|
|
+
|
|
|
+ player.on("mode.changing",(currentMode, mode, pano, duration)=>{
|
|
|
+ let noLine = mode == 'floorplan';
|
|
|
+ if(noLine){
|
|
|
+ $('.widgets-doll-labels').addClass('noLine').addClass('noCorner')
|
|
|
+ }else{
|
|
|
+ $('.widgets-doll-labels').removeClass('noLine').removeClass('noCorner')
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ player.on("view.changed",(e)=>{
|
|
|
+ if(e.cameraChanged){
|
|
|
+ //if(needUpdateZIndex){ //如果某个label显示时需要更新index的话,加个参数
|
|
|
+ let label_ = labels.filter(e=>e.elem[0].style.display == 'block')
|
|
|
+ label_.sort((a,b)=>b.pos2d.z - a.pos2d.z)
|
|
|
+ label_.forEach((e,index)=>e.elem.css('z-index', index+1000));
|
|
|
+
|
|
|
+ //}
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ player.model.hotGroup.children.length ? logSth() : player.on('gotHotAndStartload',logSth);
|
|
|
+
|
|
|
+
|
|
|
+ /* {//如果是flv格式的话
|
|
|
+ window.videoPlayer = new VideoPlayer()
|
|
|
+
|
|
|
+ if(browser.detectAndroidMobile()){//安卓常常播放不了
|
|
|
+ let scriptdom = document.querySelector('#flvJs')
|
|
|
+ if(scriptdom){
|
|
|
+ scriptdom.src = 'js/lib/flv.min.js'
|
|
|
+ scriptdom.onload = ()=>{
|
|
|
+ window.videoPlayer.changeTypeToFlv()
|
|
|
+ window.bus.dispatchEvent('VideoPlayerReady' )
|
|
|
+ //Hot.startLoad()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } */
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ window.bus.addEventListener('playerAndModelReady',f) //player model currentPano都已有
|
|
|
+ }
|
|
|
+ window.bus.dispatchEvent({type: 'THREE_inited'})
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1995,6 +2097,24 @@ var CursorDeal = {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
function logSth(){
|
|
|
let hotCount = player.model.hotGroup.children.length
|
|
|
|