Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Supported platforms and browsers


Chrome

Firefox

Safari 11

Edge

Windows

+

+


+

Mac OS

+

+

+


Android

+

+



iOS

-

-

+


Supported codecs

  • Video: H.264, VP8
  • Audio: Opus, G.711

...

Code Block
languagejs
themeRDark
    connection.join({name: getRoomName()}).on(ROOM_EVENT.STATE, function(room){
        ...
    }).on(ROOM_EVENT.JOINED, function(participant){
        ...
    }).on(ROOM_EVENT.LEFT, function(participant){
        //remove participant
        removeParticipant(participant);
        addMessage(participant.name(), "left");
    }).on(ROOM_EVENT.PUBLISHED, function(participant){
        ...
    }).on(ROOM_EVENT.FAILED, function(room, info){
        ...
    }).on(ROOM_EVENT.MESSAGE, function(message){
        ...
    });

How to record streams published by room participants

Video streams published by room participants can be recorded. To do this, 'record' parameter must be set to 'true' while publishing a stream:

Code Block
languagejs
themeRDark
    room.publish({
        display: display,
        constraints: constraints,
        record: true,
        receiveVideo: false,
        receiveAudio: false
        ...
    });

A stream from any participant is recorded to a separate file. The issue of record files futher processing is that publication of them does not begin at the same time.

Stream records synchronization

To allow streams merging, room streams may be synchronized by the first stream published. To enable this feature set the following parameter in flashphoner.properties file

Code Block
languagebash
themeRDark
enable_empty_shift_writer=true

For example, if User1 participant started publishing stream at 00:00:10, and User2 participant did it at 00:00:55, then second participant will get 45 seconds of empty video (black screen and silence) at record beginning. So, stream record files User1.mp4 and User2.mp4 will be same in duration, and they can be merged.

By default, stream records synchronization is disabled. In this case, to merge participant streams, they can be mixed while publishing.

Streams recording test

1. For test we use:

  • your WCS server, for example test2.flashphoner.com;
  • Conference web application

2. Enable stream recording in Conference application

3. Enable stream records synchronization

Code Block
languagebash
themeRDark
enable_empty_shift_writer=true

Restart WCS.

4. Open Conference application. Enter user name Alice to "Login" field and click 'Join'. The streamd from user Alice will be published:

Image Added

5. Copy room link from "Invite" field:

Image Added

6. Go to room link in new browser window.  Enter user name Bob to "Login" field and click 'Join'. The stream from Alice will be played, and stream from Bob will be published:

Image Added

7. Click 'Leave' at user Bob window to leave the room. Click 'Leave' at user Alice window to finish the conference.

8. Stream record files are placed to /usr/local/FlashphonerWebCallServer/records directory:

Code Block
languagebash
themeRDark
-rw-r--r-- 1 root root 1569566 Jun 29 07:51 stream-34296a60-7b36-11e8-bd9c-31aaed48935e-db8mp51bajcidn9qmcnda3967k.mp4
-rw-r--r-- 1 root root 516509 Jun 29 07:51 stream-5aeb2351-7b36-11e8-b398-b74e804508b2-g97j81cgrf8h1m7jl7184fa788.mp4

User Bobs' file is less then user Alices' one because Bobs' file has empty video in the beginning for futher synchronization. Download record files to PC and play them.

9. Video stream from Alice is published, Bob has not enter to the room yet:

Image Added

10. Video stream from Bob is published:

Image Added

Merging synchronized stream records using ffmpeg

Synchronized stream record files can be merged in chronological order using ffmpeg. To allow this,  when stream is created, stream timeshift relative to room creation time is specified on server side. Stream record files written by this way are merged with command (two participants example)

Code Block
languagebash
themeRDark
ffmpeg -i stream1.mp4 -i stream2.mp4 -filter_complex "[0:v]pad=iw*2:ih[int];[int][1:v]overlay=W/2:0[vid];[0:a][1:a]amerge[a]" -map [vid] -map "[a]" -ac 2 -strict -2 -c:v libx264 -crf 23 -preset veryfast output.mp4

Where

  • stream1 - first participant stream
  • stream2 - second participant stream

To merge files obtained during our test, enter the command:

Code Block
languagebash
themeRDark
ffmpeg -i stream-34296a60-7b36-11e8-bd9c-31aaed48935e-db8mp51bajcidn9qmcnda3967k.mp4 -i stream-5aeb2351-7b36-11e8-b398-b74e804508b2-g97j81cgrf8h1m7jl7184fa788.mp4 -filter_complex "[0:v]pad=iw*2:ih[int];[int][1:v]overlay=W/2:0[vid];[0:a][1:a]amerge[a]" -map [vid] -map "[a]" -ac 2 -strict -2 -c:v libx264 -crf 23 -preset veryfast output.mp4

Then play output.mp4.file:

Image Added

Image Added