1、加载标签
注意这里的id后面可以用到
viewer.entities.add({
name: "楼顶摄像头",
id: 'video',
position: Cesium.Cartesian3.fromDegrees(118.27447066535073, 33.96131002247034, 70.79132996761848),
billboard: {
image: '/video.png',
scale: 0.2,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
},
});
2、监听点击事件
点击后显示视频组件并播放视频
var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(function (movement) {
var pick = viewer.scene.pick(movement.position);
if (Cesium.defined(pick) && (pick.id.id === 'video')) {
console.log('wooooo',pick)
that.showVideo = true
that.videoUrl = 'www.wangshuo.vip.mp4'
}
}, Cesium.ScreenSpa