将video.js映射为three.js中的纹理

时间:2016-04-18 08:55:19

标签: javascript three.js video-streaming video.js videotexture

我正在尝试使用video.js在HLS中获取流并将其作为Three.js多维数据集中的videoTexture播放:

<video id=example-video width=960 height=400 class="video-js vjs-default-skin" controls>
    <source
         src="//s3.amazonaws.com/_bc_dml/example-content/tears-of-steel/playlist.m3u8"
         type="application/x-mpegURL">
    </video>

        <script src="//vjs.zencdn.net/5.4/video.js"></script>
    <script src="js/videojs-contrib-hls.min.js"></script>
    <script src="js/three.min.js"></script>
    <script>
        var scene = new THREE.Scene();
        var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 1000 );

            var player = videojs('example-video');
            player.play();
            var texture =  THREE.VideoTexture(player);

        var renderer = new THREE.WebGLRenderer();
        renderer.setSize( window.innerWidth, window.innerHeight );
        document.body.appendChild( renderer.domElement );


        var geometry = new THREE.BoxGeometry( 1, 1, 1 );
        var material = new THREE.MeshBasicMaterial( { color: 0xffffff, map: texture} );
        var cube = new THREE.Mesh( geometry, material );
        scene.add( cube );

        {...}

        renderer.render(scene, camera);

我正确播放流的默认播放器,但我的立方体是全白的。

  

THREE.Material:'map'参数未定义。

将视频作为纹理传递给three.js的任何想法?

感谢。

0 个答案:

没有答案