To create a transition between streams, you should use the StreamsAdd method for streams or StreamsBackgroundSet method for the background. You set the properties of the transition through _bsParam and _dblTimeForChange parameters.
If you do not set _bsParam but set _dblTimeForChange then "fade" type of transition is applied.
You should use an ID of a stream that you need to change as the _bsStreamID parameter in StreamsAdd method.
Transitions to files
//iris transition for 2 seconds
myMixer.StreamsAdd(stream_id, null, pathToFile, "transition=iris", out pFile, 2.0);
//fade transition for 3 seconds
myMixer.StreamsAdd(stream_id, null, pathToFile, "", out pFile, 3.0);
Transition parameters
To set transition parameters, for example, audio delay, you should include all parameters in single quotes:
myMixer.StreamsAdd( stream_id, null, "C:\file.avi", "playlist transition='type=iris audio_delay=1.0'", out pFile, 2.0);
Available transitions are listed in this article.
Transitions to external objects
You can use external objects as a sources for streams - MLive, MPlaylist object. For example, a live source:
//Initialize object
objLive = new MLiveClass();
// .. configure the live source
//set transition
myMixer.StreamsAdd( stream_id, objLive, "live_src", "live transition=pixelate", out pFile, 3.0);
After a transition is over, the previous object is closed. To avoid this you should use "mp://" protocol link on source object (you can read more about it here).
string sName;
m_objFile.ObjectNameGet(out sName);
myMixer.StreamsAdd("0", null, "mp://" + sName, "", out pFile, 0);
If you use a transition from a live source to another source then, to avoid live object close, you can use "external_object" parameter. This parameter indicates whether a source object will be closed ("false") or not ("true") after the transition is completed.
myMixer.StreamsAdd("0", objLive, "live_src", "external_object=true", out pFile, 0);
Transitions with T-Bar control
To operate transitions with T-Bar control you need:
Set negative time as _dblTimeForChange parameter in StreamsAdd method:
myMixer.StreamsAdd(stream_id, null, pathToFile, "transition=iris", out pNewItem, -1.0);
To start transition you should set "trans_pos" property for the new item
(pNewItem.PropsSet("trans_pos", "0.5"));
Possible values for the property are from 0.0 to 1.0, where 0.0 is the beginning of the transition (the initial stream is visible) and 1.0 is the end of the transition (the new stream is visible).
To end transition you should set "trans_pos" greater than "1.0". Only after the transition is over, the previous source is closed and released.