aframe视频播放暂停
aframe video play pause
我在运行时动态添加视频,因此无法使用资产管理器。
我正在尝试使用 a-video
,然后 play/pause。
我尝试创建一个 videoEl 并将其用作 src
this._videoPlayer = document.createElement('video')
this._videoPlayer.id = 'video'
this._videoPlayer.onloadeddata = this.onLoaded.bind(this)
this._videoEl.setAttribute('src', this._videoPlayer)
或
this._videoEl.setAttribute('src', '#video')
但视频未被识别为资产
然后我考虑使用 THREE.VideoTexture(this._videoPlayer)
,但是我不知道在 a-plane
material 上设置纹理的位置。
知道如何使用简单的 videoElement 而不是资产管理器将视频添加到框架中吗?
如果使用选择器,请务必将视频附加到 DOM。
如果是普通实体,请使用 .setAttribute('material', 'src', VIDEO)
。
this._videoPlayer = document.createElement('video')
this._videoPlayer.id = 'video'
this._videoPlayer.onloadeddata = this.onLoaded.bind(this)
document.body.appendChild(this._videoPlayer); // Append to DOM.
this._videoEl.setAttribute('material', 'src', '#video')
如果您只设置原始 URL,然后 el.getObject3D('mesh').material.map.image
。
,也可以访问视频元素
我在运行时动态添加视频,因此无法使用资产管理器。
我正在尝试使用 a-video
,然后 play/pause。
我尝试创建一个 videoEl 并将其用作 src
this._videoPlayer = document.createElement('video')
this._videoPlayer.id = 'video'
this._videoPlayer.onloadeddata = this.onLoaded.bind(this)
this._videoEl.setAttribute('src', this._videoPlayer)
或
this._videoEl.setAttribute('src', '#video')
但视频未被识别为资产
然后我考虑使用 THREE.VideoTexture(this._videoPlayer)
,但是我不知道在 a-plane
material 上设置纹理的位置。
知道如何使用简单的 videoElement 而不是资产管理器将视频添加到框架中吗?
如果使用选择器,请务必将视频附加到 DOM。
如果是普通实体,请使用 .setAttribute('material', 'src', VIDEO)
。
this._videoPlayer = document.createElement('video')
this._videoPlayer.id = 'video'
this._videoPlayer.onloadeddata = this.onLoaded.bind(this)
document.body.appendChild(this._videoPlayer); // Append to DOM.
this._videoEl.setAttribute('material', 'src', '#video')
如果您只设置原始 URL,然后 el.getObject3D('mesh').material.map.image
。