Search code examples
kurento

How to stream from disk in kurento? (with node.js)


How can I stream a file from disk (with node.js)? I rummaged through all the documentation and found nothing.


Solution

  • presenter[watchUserId].pipeline.create('PlayerEndpoint', {uri: 'file:///var/www/domain/public/webm2/file.webm', networkCache: 0 }, (err, playerEndpoint) => {
                        if(err){
                            console.error('error at create PlayerEndpoint');
                            presenter[watchUserId].pipeline.release();
                            callback(err);
                        }
    

    as example. Just use PlayerEndpoint with file:/// in uri.

    and then

    playerEndpoint.connect(webRtcEndpoint, function(err){
                                        if(err){
                                            console.error('error at create connect');
                                            presenter[watchUserId].pipeline.release();
                                        }
    
                                        setTimeout(function(){
                                            playerEndpoint.play(function(err){
                                                console.error(err);
                                            });
                                        }, 5000);
    
                                    });
    

    connect playerEndpoint and webRtcEndpoint