Dynamic MCU mixer layout

kindco

Member
Hello,
We are developing a live meeting app, where meeting host can speak on their own or give a word to one of several participants (only one at a time). Thus, mixer stream can contain either single host stream or host and single participant streams. In the first case host stream must be full screen, and in the second case participant stream must be full screen and host stream must be decreased to a small preview somewhere in the corner. In other words, we need something very similar to "Picture in picture" layout (https://docs.flashphoner.com/display/WCS52EN/Stream+mixer#Streammixer-Pictureinpicture), but a dynamic one: it must be enabled by default, but then other stream may become a "desktop" one on the fly.
Is this possible with existing layouts, or we need to create our own layout class for this purpose?
 

kindco

Member
Actually, I see that desktop layout is used (dynamically?) when a participant joins the meeting with "desktop" stream name, but "picture in picture" layout doesn't work despite of mixer_video_desktop_fullscreen=true setting.
 

Max

Administrator
Staff member
Good day.
For two person video chat, mixer seems to be excessive. You can just publish and play two streams from two participants, and change webpage or application layout on client side as you wish. In this case, you can use mixer to record the meeting.
But, if you prefer to use mixer, you should:
1. Enable picture in picture mode
Code:
mixer_video_desktop_fullscreen=true
2. Create mixer and add host stream to it with name host_desktop for example.
3. Add participant stream to mixer with name participant. The stream host_desktop will be fullscreen.
4. To make participant full screen:
4.1. Remove participant stream from mixer
4.2. Publish participant stream with name participant_desktop and add it to mixer
4.3. Remove host_desktop stream from mixer
4.4. Publish host stream with name host and add it to mixer
This seems to be a slightly complex, but desktop layout switching is strictly depends on stream name. The stream in its turn cannot be renamed without republishing because stream name is an unique identifier for server.
 

kindco

Member
Hello @Max ,
Thank you for your answer.

What we are developing is not a 1-to-1 chat, it's a conference, where only one participant can have a word at a time. During all the conference, all participants are watching it in real time, even those who are not speaking. And yes, we need to record it too. So I think mixer is the only option here, even though its possibilities are not used by 100%.

What you wrote about changing stream names makes sense. The only problem is in our specific workflow: we don't know the exact moment when participant joins the mixer, so we don't know when exactly we need to republish host stream with a different name.

For me, the best option would be to create a custom layout class. Because what we need is exactly "picture in picture" layout, but with one simple condition that sets stream precedence. Something like: "if stream name is exactly "desktop" it is fullscreen, else if it contains "desktop" it is fullscreen". In this case stream name containing "desktop" in its name will be fullscreen until stream with exactly "desktop" name appears. Maybe you'll find this change worth implementing in default WCS layout, but if not, can I see current "desktop" layout class code so I can make my custom one based on in?
 

Max

Administrator
Staff member
We prepared the custom fullscreen layout example (see attach):
- regular streams are grouped at the botton of screen;
- if the stream name contains fullscreen, for example test_fullscreen, this stream fill the screen behind the regular streams
- if the stream name exactly equals fullscreen, this stream fill the screen, the stream like test_fullscreen becomes regular
Please review the code and modify it as you need.
 

Attachments

kindco

Member
Thank you once again for the reply.

I sat down to work on this and ended up discovering that our droplet is almost out of storage space. I traced the issue to
/usr/local/FlashphonerWebCallServer/logs/client_logs which has folders dating back to 2020-10-06 when we first set up the droplet on Digital Ocean. Some of the folders within are extremely large, for example client_logs/2021-01-18 - 13G

So at this point I have two questions:

1) Can you think of a reason why these log files have gotten so large
2) Would purging logs older than the past 2 weeks on cron cause any issues with the software?

If there is no issue with removing old logs, I will set up a simple bash script to run on daily cron and remove log folders older than 2 weeks. Thank you!
 

Max

Administrator
Staff member
1) Can you think of a reason why these log files have gotten so large
Please check if client debug logging is enabled, if yes, disable it by commenting the following line in flashphoner.properties file
Code:
client_log_level=debug
If this is production server, we recommend also to disable clien logs at all
Code:
enable_extended_logging=false
and decrease server log output in log4j.properties file
Code:
log4j.rootLogger=warn, stdout, fAppender
2) Would purging logs older than the past 2 weeks on cron cause any issues with the software?
No, you can set up logs deletion older than two weeks by cron, for example
Code:
0 0 * * * find /usr/local/FlashphonerWebCallServer/logs/server_logs/ -type f -mtime +14 | xargs rm -rf
0 0 * * * find /usr/local/FlashphonerWebCallServer/logs/client_logs/ -type d -mtime +14 | xargs rm -rf
 

kindco

Member
@Max
Thank you, I've disabled client logging and removed old logs.

Now I wanted to compile the layout class, but got Java errors cannot find symbol for Box and BoxPosition classes. I updated the server (it was a bit outdated), but still get the same errors. So, my questions are: is there any possibility that WCS was updated incorrectly or incompletely? if so, how can I check this? how can I reinstall it?

I'm asking this because sudo ./webcallserver update says "You have latest version":
2021-01-28_14-51-41.png

but demo page shows old version number:
2021-01-28_14-53-24.png
 

Max

Administrator
Staff member
There seems to be two different issues here:
I already tried to, but it says that WCS is already installed.
1. Update problem. To check this, please provide us SSH access to the server using this private form, we will check.
And at the same time I'm still getting "cannot find symbol" errors:
2. Custom layout build problem. We raised the ticket WCS-3055 to fix this, and let you know results here.
 

Max

Administrator
Staff member
We've checked your server.
Seems like server is updated normally, but the previous build 5.2.874 is running from root. So it should be stopped manually
Code:
cd /usr/local/FlashphonerWebCallServer/bin
./webcallserver stop
Then, it can be started as service from user flashphoner
Code:
systemctl restart webcallserver
The new build should start.
 

kindco

Member
@Max
Thank you!

./webcallserver stop returns FlashphonerWebCallServer: not running (I suppose you already executed this command before). Anyway, I tried both the commands you suggested, but demo site still shows version v.0.5.28.2753-5.2.874-cc1882d229ecf32ff112a0a0a0bdf117e28a46ac :( This means that old version is still running somewhere somehow, right?
 

Max

Administrator
Staff member
This means that old version is still running somewhere somehow, right?
Yes. In this case, use the command
Code:
kill `pidof java`
to stop WCS process
Then restart service as described above.
 
We prepared the custom fullscreen layout example (see attach):
- regular streams are grouped at the botton of screen;
- if the stream name contains fullscreen, for example test_fullscreen, this stream fill the screen behind the regular streams
- if the stream name exactly equals fullscreen, this stream fill the screen, the stream like test_fullscreen becomes regular
Please review the code and modify it as you need.
Hello, in this respect, can xml/java layout file be re-applied to a mixer? With java, can we manually call the "computeLayout" method to re-calculate layout on line 38?

As for what "kindco" user asked: I think this can be accomplished without re-publishing on the client side, however, it's going to be an overkill as you basically double the amount of streams.

1. client0 starts publishing client0_stream;
2. client1 starts publishing client1_stream;
3. re-publish client0_stream on the server with rest-api/pull/push remoteStreamName -> client0_stream_server
4. add stream client0_stream_server to mixer
5. do the same with client1_stream
6. then, when you need to change layout, you drop client0_stream_server and republish it under a different name and then add it to the mixer

This is an overkill as it doubles the amount of streams but unless there is a way of calling xml/java manually to re-apply layout I don't see any other way of how to manage layout in realtime with existing streams. This would have been a cool feature along with transitions.
 

Max

Administrator
Staff member
Thanks for info, but as far as I understand, there is no way of re-applying a layout either through java or xml on existing streams, is that right? A layout is updated only on stream create/delete, as far as i see.
 

Max

Administrator
Staff member
Actually, the custom layout is a folder with N files

1.mix
2.mix
..
N.mix

If 1 participant in the mixer then 1.mix config will be taken as XML layout
If 2 participant in the mixer then 2.mix config will be taken as XML layout
etc

Yes. You can set layout folder during mixer creation.

/rest-api/mixer/startup
{
"uri": "mixer://mixer1",
"localStreamName": "mixer1_stream",
"hasVideo": true,
"hasAudio": false,
"mixerLayoutDir": "/opt/mixer1-layout"
}
 
Top