IRTCClient::SetPreferredMediaTypes

The SetPreferredMediaTypes method sets the media types that are preferred for use by new (outgoing or incoming) sessions. The sessions will use the intersection of this set of media types and the set of media types that are available on the session.

HRESULT SetPreferredMediaTypes(longlMediaTypes,
VARIANT_BOOLfPersistent);

Parameters

  • lMediaTypes
    [in] RTCMT_ flags containing the possible media types.
  • fPersistent
    [in] If TRUE, the media types set in this method will persist between instances of the application.

Return Values

RTC methods may return an RTC_E_ constant.

Value Meaning
E_INVALIDARG Invalid media type.
RTC_E_CLIENT_NOT_INITIALIZED The client has not been initialized.

Remarks

The value that this method sets will persist for each user after the application is shut down.

The lMediaTypes parameter sets the media types globally for all sessions on the current client object. This setting dictates which media types can be accepted for incoming PC_TO_PC sessions. If the media types offered on an incoming PC_TO_PC session are not allowed, the RTC API rejects the incoming session without notifying the application. This setting also dictates the media types allowed for newly created outgoing PC_TO_PC sessions.

Note that calling the IRTCSession::AddStream and IRTCSession::RemoveStream methods will change the media types allowed by the RTC API. The application should call SetPreferredMediaTypes with the appropriate value before creating a new outgoing PC-to-PC session. The application should also call this method after disconnecting from a session in which IRTCSession::AddStream or IRTCSession::RemoveStream has been called. This ensures that the application will receive notifications of incoming PC-to-PC sessions with the preferred media types.

Requirements

Client: Requires Windows XP.
Server: Requires Windows Server 2003.
Redistributable: Requires Rtcdll.dll on Windows 2000, and Windows Me/98.
Header: Declared in Rtccore.h.
Library: Included as a resource in Rtcdll.dll.
GUID: IID_IRTCClient is defined as 07829e45-9a34-408e-a011-bddf13487cd1.

See Also

Add to Media Preferences, IRTCClient, IRTCCLient::get_PreferredMediaTypes