Share via


Add to Media Preferences

The following code example demonstrates how to add media preferences, such as Application Sharing, to an RTC application. The operations in the Initialize RTC code example must be performed before using this example.

Note  This example does not contain error checking or releases appropriate for real code.

C++ Code Example

HRESULT     hr         =  S_OK;
LONG        lGetMedia  =  0;
LONG        lSetMedia  =  0;

// Get the existing media capabilities.
hr = pIRTCClient->get_PreferredMediaTypes(&lGetMedia);

// Add in the new media type.
lSetMedia = lGetMedia | RTCMT_T120_SENDRECV;

// Set the media capabilities with no persistence.
hr = pIRTCClient->SetPreferredMediaTypes(lSetMedia, VARIANT_FALSE);

Visual Basic Code Example

'Set the error handling routine here. 
' On Error GoTo MyErrorRoutine 

Dim MediaCaps As Long

'Get media types that are supported by the current hardware.
MediaCaps = g_objRTCClient.PreferredMediaTypes

'Add media capabilities.
MediaCaps = MediaCaps Or RTCMT_T120_SENDRECV

'Set the new media types.
Call g_objRTCClient.SetPreferredMediaTypes(MediaCaps, False)