Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Three.js A帧视频播放暂停_Three.js_Aframe - Fatal编程技术网

Three.js A帧视频播放暂停

Three.js A帧视频播放暂停,three.js,aframe,Three.js,Aframe,我正在运行时动态添加视频,因此无法使用资产管理器 我正在尝试使用a-video,然后播放/暂停它 我尝试创建一个videoEl并将其用作src this._videoPlayer = document.createElement('video') this._videoPlayer.id = 'video' this._videoPlayer.onloadeddata = this.onLoaded.bind(this) this._videoEl.setAttribute('src',

我正在运行时动态添加视频,因此无法使用资产管理器

我正在尝试使用
a-video
,然后播放/暂停它

我尝试创建一个videoEl并将其用作src

 this._videoPlayer = document.createElement('video')
 this._videoPlayer.id = 'video'
 this._videoPlayer.onloadeddata = this.onLoaded.bind(this)
 this._videoEl.setAttribute('src', this._videoPlayer)

但该视频未被视为资产

然后我考虑使用
THREE.VideoTexture(这个.\u videoPlayer)
,但是我不知道在
a平面
材质上设置纹理的位置


你知道我将如何使用一个简单的视频元素而不是资产管理器向一个帧添加视频吗

如果使用选择器,请确保将视频附加到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
,也可以访问视频元素

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')