Class LayoutManager<T>
A class that supplies simple video frame layout management.
Inheritance
Implements
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public abstract class LayoutManager<T> : LayoutPreset, IEquatable<NSObject>, INSObjectProtocol, INativeObject, IDisposable
Type Parameters
| Name | Description |
|---|---|
| T |
Constructors
LayoutManager()
Initializes a new instance of the LayoutManager<T> class.
Declaration
public LayoutManager()
LayoutManager(LayoutPreset)
Initializes a new instance of the LayoutManager<T> class.
Declaration
public LayoutManager(LayoutPreset preset)
Parameters
| Type | Name | Description |
|---|---|---|
| LayoutPreset | preset |
Properties
LayoutOrigin
Gets or sets the layout origin. Defaults to TopLeft.
Declaration
public virtual LayoutOrigin LayoutOrigin { get; protected set; }
Property Value
| Type | Description |
|---|---|
| LayoutOrigin |
Methods
AddRemoteMedia(IViewableMedia<T>)
Adds remote media to the layout.
Declaration
public bool AddRemoteMedia(IViewableMedia<T> remoteMedia)
Parameters
| Type | Name | Description |
|---|---|---|
| IViewableMedia<T> | remoteMedia | The remote media. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
AddRemoteView(String, T)
Adds a remote view to the layout.
Declaration
public bool AddRemoteView(string id, T view)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id | The remote view ID. |
| T | view | The remote view. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
AddRemoteViews(String[], T[])
Adds remote views to the layout.
Declaration
public bool AddRemoteViews(string[] ids, T[] views)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String[] | ids | The remote view IDs. |
| T[] | views | The remote views. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
AddView(T)
Adds a view to the container.
Declaration
protected abstract void AddView(T view)
Parameters
| Type | Name | Description |
|---|---|---|
| T | view | The view to add. |
DispatchToMainThread(Action2<Object, Object>, Object, Object)
Dispatches an action to the main thread.
Declaration
protected abstract void DispatchToMainThread(Action2<object, object> action, object arg1, object arg2)
Parameters
| Type | Name | Description |
|---|---|---|
| Action2<System.Object, System.Object> | action | The action to invoke. |
| System.Object | arg1 | The first argument. |
| System.Object | arg2 | The second argument. |
DoGetLocalView()
Gets the local view.
Declaration
protected virtual T DoGetLocalView()
Returns
| Type | Description |
|---|---|
| T | The local view. |
DoGetRemoteViews(String)
Gets the remote views for a given remote view ID.
Declaration
protected virtual List<T> DoGetRemoteViews(string id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id | The remote view ID. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<T> | The remote views. |
DoGetRemoteViewsIds()
Gets the remote view IDs.
Declaration
protected virtual string[] DoGetRemoteViewsIds()
Returns
| Type | Description |
|---|---|
| System.String[] | The remote view IDs. |
GetLayout(Int32, Int32, Boolean, Int32)
Gets a video frame layout.
Declaration
protected virtual Layout GetLayout(int layoutWidth, int layoutHeight, bool local, int remoteCount)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | layoutWidth | The total width of the layout. |
| System.Int32 | layoutHeight | The total height of the layout. |
| System.Boolean | local | Whether a local frame is needed. |
| System.Int32 | remoteCount | The number of remote frames. |
Returns
| Type | Description |
|---|---|
| Layout | The video frame layout. |
GetLayout(Int32, Int32, Boolean, Int32, String[])
Gets a video frame layout.
Declaration
protected virtual Layout GetLayout(int layoutWidth, int layoutHeight, bool local, int remoteCount, string[] remoteViewIds)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | layoutWidth | The total width of the layout. |
| System.Int32 | layoutHeight | The total height of the layout. |
| System.Boolean | local | Whether a local frame is needed. |
| System.Int32 | remoteCount | The number of remote frames. |
| System.String[] | remoteViewIds | The remote view IDs. |
Returns
| Type | Description |
|---|---|
| Layout | The video frame layout. |
GetLayout(Int32, Int32, Boolean, Int32, String[], Size, Size[])
Gets a video frame layout.
Declaration
protected virtual Layout GetLayout(int layoutWidth, int layoutHeight, bool local, int remoteCount, string[] remoteViewIds, Size localVideoSize, Size[] remoteVideoSizes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | layoutWidth | The total width of the layout. |
| System.Int32 | layoutHeight | The total height of the layout. |
| System.Boolean | local | Whether a local frame is needed. |
| System.Int32 | remoteCount | The number of remote frames. |
| System.String[] | remoteViewIds | The remote view IDs. |
| Size | localVideoSize | The local video size. |
| Size[] | remoteVideoSizes | The remote video sizes. |
Returns
| Type | Description |
|---|---|
| Layout | The video frame layout. |
GetLayout(Int32, Int32, Int32)
Gets a video frame layout.
Declaration
protected virtual Layout GetLayout(int layoutWidth, int layoutHeight, int remoteCount)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | layoutWidth | The total width of the layout. |
| System.Int32 | layoutHeight | The total height of the layout. |
| System.Int32 | remoteCount | The number of remote frames. |
Returns
| Type | Description |
|---|---|
| Layout | The video frame layout. |
GetLayout(Int32, Int32, Int32, String[])
Gets a video frame layout.
Declaration
protected virtual Layout GetLayout(int layoutWidth, int layoutHeight, int remoteCount, string[] remoteViewIds)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | layoutWidth | The total width of the layout. |
| System.Int32 | layoutHeight | The total height of the layout. |
| System.Int32 | remoteCount | The number of remote frames. |
| System.String[] | remoteViewIds | The remote view IDs. |
Returns
| Type | Description |
|---|---|
| Layout | The video frame layout. |
GetLocalView()
Gets the local view from the layout.
Declaration
public T GetLocalView()
Returns
| Type | Description |
|---|---|
| T | The local view. |
GetRemoteView(String)
Gets a remote view from the layout.
Declaration
public T GetRemoteView(string id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id | The remote view ID. |
Returns
| Type | Description |
|---|---|
| T | The remote view. |
GetRemoteViewIds()
Gets the IDs of the remote views in the layout.
Declaration
public string[] GetRemoteViewIds()
Returns
| Type | Description |
|---|---|
| System.String[] | The remote view IDs. |
GetRemoteViews()
Gets all remote views from the layout.
Declaration
public List<T> GetRemoteViews()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<T> | The remote views. |
GetRemoteViews(String[])
Gets remote views from the layout.
Declaration
public List<T> GetRemoteViews(string[] ids)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String[] | ids | The remote view IDs. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<T> | The remote views. |
Layout()
Positions the local and remote views within the layout.
Declaration
public abstract void Layout()
LayoutOnMainThread()
Positions the local and remote views within the layout after dispatching to the main thread.
Declaration
public void LayoutOnMainThread()
RemoveRemoteMedia(IViewableMedia<T>)
Removes remote media from the layout.
Declaration
public bool RemoveRemoteMedia(IViewableMedia<T> remoteMedia)
Parameters
| Type | Name | Description |
|---|---|---|
| IViewableMedia<T> | remoteMedia | The remote media. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
RemoveRemoteView(String)
Removes a remote view from the layout.
Declaration
public bool RemoveRemoteView(string id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id | The remote view ID. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
RemoveRemoteViews()
Removes all remote views from the layout.
Declaration
public void RemoveRemoteViews()
RemoveRemoteViews(String[])
Removes remote views from the layout.
Declaration
public bool RemoveRemoteViews(string[] ids)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String[] | ids | The remote view IDs. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
RemoveView(T)
Removes a view from the container.
Declaration
protected abstract void RemoveView(T view)
Parameters
| Type | Name | Description |
|---|---|---|
| T | view | The view to remove. |
Reset()
Removes all remote views from the layout, then removes the local view from the layout.
Declaration
public void Reset()
SetLocalMedia(IViewableMedia<T>)
Adds the local media to the layout.
Declaration
public bool SetLocalMedia(IViewableMedia<T> localMedia)
Parameters
| Type | Name | Description |
|---|---|---|
| IViewableMedia<T> | localMedia | The local media. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
SetLocalView(T)
Adds the local view to the layout.
Declaration
public bool SetLocalView(T view)
Parameters
| Type | Name | Description |
|---|---|---|
| T | view | The local view. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
SwapRemoteMedia(IViewableMedia<T>, IViewableMedia<T>)
Swaps remote media in the layout.
Declaration
public bool SwapRemoteMedia(IViewableMedia<T> remoteMediaToRemove, IViewableMedia<T> remoteMediaToAdd)
Parameters
| Type | Name | Description |
|---|---|---|
| IViewableMedia<T> | remoteMediaToRemove | The remote media to remove. |
| IViewableMedia<T> | remoteMediaToAdd | The remote media to add. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
SwapRemoteView(String, String, T)
Swaps a remote view in the layout.
Declaration
public bool SwapRemoteView(string idToRemove, string idToAdd, T viewToAdd)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | idToRemove | The remote view ID to remove. |
| System.String | idToAdd | The remote view ID to add. |
| T | viewToAdd | The remote view to add. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
SwapRemoteViews(String[], String[], T[])
Swaps remote views in the layout.
Declaration
public bool SwapRemoteViews(string[] idsToRemove, string[] idsToAdd, T[] viewsToAdd)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String[] | idsToRemove | The remote view IDs to remove. |
| System.String[] | idsToAdd | The remote view IDs to add. |
| T[] | viewsToAdd | The remote views to add. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
UnsetLocalView()
Removes the local view from the layout.
Declaration
public bool UnsetLocalView()
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Events
OnLayout
Raised when a layout is calculated.
Declaration
public event Action1<Layout> OnLayout
Event Type
| Type | Description |
|---|---|
| Action1<Layout> |