...
By default, mixer will stop after 60 seconds if there are no active incoming streams.
Mixer output stream layout management
By default, three mixer output stream layouts are implemented:
1. Grid layoud
This layout can be enabled with the following parameter in flashphoner.properties file
Code Block | ||
---|---|---|
| ||
mixer_layout_class=com.flashphoner.media.mixer.video.presentation.GridLayout |
2. Zero padding grid layout
This layout can be enabled with the following parameter
Code Block | ||
---|---|---|
| ||
mixer_layout_class=com.flashphoner.media.mixer.video.presentation.CenterNoPaddingGridLayout |
and works for input streams with the same resolution and aspect ratio only
3. Desktop (screen sharing) layout
This layout is enabled if one of mixer input streams has a name defined in the following parameter
Code Block | ||
---|---|---|
| ||
mixer_video_layout_desktop_key_word=desktop |
By default, desktop
name is used for screen sharing stream.
Custom mixer layout implementation
For more fine tuning of mixer layout, custom Java class should be developed to implement IVideoMixerLayout
interface, for example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
package com.flashphoner.mixerlayout;
import com.flashphoner.media.mixer.video.presentation.Box;
import com.flashphoner.media.mixer.video.presentation.BoxPosition;
import com.flashphoner.media.mixer.video.presentation.VideoLayout;
import com.flashphoner.sdk.media.IVideoMixerLayout;
import com.flashphoner.sdk.media.YUVFrame;
import java.util.ArrayList;
public class TestLayout extends VideoLayout {
private static final int PADDING = 5;
@Override
public Layout[] compute(YUVFrame[] frames, int canvasWidth, int canvasHeight) {
return computeGrid(frames, canvasWidth, canvasHeight);
}
private IVideoMixerLayout.Layout[] computeGrid(YUVFrame[] frames, int canvasWidth, int canvasHeight) {
Box mainBox = new Box(null, canvasWidth, canvasHeight);
for (int i = 0; i < frames.length; i++) {
Box frameBox = new Box(mainBox, canvasWidth/frames.length, canvasHeight/frames.length);
frameBox.setPosition(BoxPosition.INLINE_HORIZONTAL_CENTER);
frameBox.setPaddingLeft(PADDING);
frameBox.setPaddingRight(PADDING);
Box frame = new Box(frameBox, frames[i]);
frame.setPosition(BoxPosition.INLINE_HORIZONTAL);
frame.fillParent();
}
ArrayList<IVideoMixerLayout.Layout> layout = new ArrayList<>();
mainBox.computeLayout(layout);
return layout.toArray(new IVideoMixerLayout.Layout[layout.size()]);
}
} |
Then the class should be complied into byte code. To do this, create folder tree accordind to TestLayout class package name
Code Block | ||||
---|---|---|---|---|
| ||||
mkdir -p com/flashphoner/mixerlayout |
and execute the command
Code Block | ||||
---|---|---|---|---|
| ||||
javac -cp /usr/local/FlashphonerWebCallServer/lib/tbs-flashphoner.jar ./com/flashphoner/mixerlayout/TestLayout.java |
Now, pack the code compiled to jar file
Code Block | ||||
---|---|---|---|---|
| ||||
jar -cf testlayout.jar ./com/flashphoner/mixerlayout/TestLayout.class |
and copy this file to WCS libraries folder
Code Block | ||||
---|---|---|---|---|
| ||||
cp testlayout.jar /usr/local/FlashphonerWebCallServer/lib |
To use custom mixer layout class, set it to the following parameter in flashphoner.properties file
Code Block | ||
---|---|---|
| ||
mixer_layout_class=com.flashphoner.mixerlayout.TestLayout |
and restart WCS.
With this custom layout, mixer output stream for three input streams will look like:
Quick manual on testing
1. For this test we use:
...