generic questions

Max

Administrator
Staff member
however, it seems there is a little issue in the transcoding process: the stream is a bit "choppy". more precisly it looks like the video makes some "backward" of a micro second, resulting in this strange choppy effect. didnt see this behavior with my app using wowza, so maybe there is a fix to apply to transcoding. did u notice the same behavior during your tests ?
Try to add this ffmpeg option:
-preset ultrafast
It should fix the choppy effect.
Yes we were able to see such effect and plan to fix this soon for non-ultrafast encoding options.
 

Max

Administrator
Staff member
so now final question about this: i need to "mix" this screen sharing feature in video conferencing.
You can play a stream via Room API if it is a stream of a joined participant.
ffmpeg with its RTMP stream can't join as a participant.
Therefore you can't play ffmpeg's stream inside the room.

As a workaround, you can create a new session as in the normal player example:
https://wcs5-eu.flashphoner.com/demo2/player
https://github.com/flashphoner/flas...examples/demo/streaming/player/player.js#L104
Code:
Flashphoner.createSession({urlServer: url}).on(SESSION_STATUS.ESTABLISHED, function(session){
        setStatus(session.status());
        //session connected, start playback
        playStream(session);
    }).on(SESSION_STATUS.DISCONNECTED, function(){
        setStatus(SESSION_STATUS.DISCONNECTED);
        onStopped();
    }).on(SESSION_STATUS.FAILED, function(){
        setStatus(SESSION_STATUS.FAILED);
        onStopped();
    });
Then broadcast your ffmpeg stream name inside the room as a text message.
Then each participant should play this stream name as in the normal player example:
https://wcs5-eu.flashphoner.com/demo2/player
https://github.com/flashphoner/flas...examples/demo/streaming/player/player.js#L132
Code:
stream = session.createStream(options).on(STREAM_STATUS.PLAYING, function(stream) {
        $("#preloader").show();
        // For WSPlayer
        if (stream.getInfo() == "FIRST_FRAME_RENDERED")
            $("#preloader").hide();
        document.getElementById(stream.id()).addEventListener('resize', function(event){
            $("#preloader").hide();
            var streamResolution = stream.videoResolution();
            if (Object.keys(streamResolution).length === 0) {
                resizeVideo(event.target);
            } else {
                // Change aspect ratio to prevent video stretching
                var ratio = streamResolution.width / streamResolution.height;
                var newHeight = Math.floor(options.playWidth / ratio);
                resizeVideo(event.target, options.playWidth, newHeight);
            }
        });
        setStatus(stream.status());
        onStarted(stream);
    }).on(STREAM_STATUS.STOPPED, function() {
        setStatus(STREAM_STATUS.STOPPED);
        onStopped();
    }).on(STREAM_STATUS.FAILED, function() {
        setStatus(STREAM_STATUS.FAILED);
        onStopped();
    }).on(STREAM_STATUS.NOT_ENOUGH_BANDWIDTH, function(stream){
        console.log("Not enough bandwidth, consider using lower video resolution or bitrate. Bandwidth " + (Math.round(stream.getNetworkBandwidth() / 1000)) + " bitrate " + (Math.round(stream.getRemoteBitrate() / 1000)));
    });
    stream.play();
Therefore:
1. Publish stream 333 via ffmpeg.
2. Broadcast stream name 333 inside the room using participant.sendMessage() for each participant in the room.
3. Create a new playback session and play stream 333 by each participant in the room.
 
Top