Versions Compared

Key

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

...

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

Image Added

This layout can be enabled with the following parameter in flashphoner.properties file

Code Block
themeRDark
mixer_layout_class=com.flashphoner.media.mixer.video.presentation.GridLayout

2. Zero padding grid layout

Image Added

This layout can be enabled with the following parameter

Code Block
themeRDark
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

Image Added

This layout is enabled if one of mixer input streams has a name defined in the following parameter

Code Block
themeRDark
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
languagejava
themeRDark
titleTestLayout.java
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
languagebash
themeRDark
mkdir -p com/flashphoner/mixerlayout

and execute the command

Code Block
languagebash
themeRDark
javac -cp /usr/local/FlashphonerWebCallServer/lib/tbs-flashphoner.jar ./com/flashphoner/mixerlayout/TestLayout.java

Now, pack the code compiled to jar file

Code Block
languagebash
themeRDark
jar -cf testlayout.jar ./com/flashphoner/mixerlayout/TestLayout.class

and copy this file to WCS libraries folder

Code Block
languagebash
themeRDark
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
themeRDark
mixer_layout_class=com.flashphoner.mixerlayout.TestLayout

and restart WCS.

With this custom layout, mixer output stream for three input streams will look like:

Image Added

Quick manual on testing

1. For this test we use:

...