Remarks
Callback delegate invoked during a casting session previously created by one between the CastingCreateFromPlayer, CastingWmaPubPointOpenForPlayer or CastingWmaNetworkOpenForPlayer methods: this callback can be set through a call to the CallbackForCastingEventsSet method.
For further details about callback delegates see the How to synchronize the container application through callback delegates tutorial.
Further information about management of casting sessions can be found inside the How to use the control as a source for streaming servers like SHOUTcast tutorial.
For further details about the use of WASAPI loopback devices see the WASAPIMan class and the How to manage audio flow through WASAPI tutorial
Syntax
[Visual Basic]
Public Delegate Sub CallbackForCastingEvents (
ByVal nEvent as enumCastingEvents,
ByVal nCastingUniqueId as Int32,
ByVal nData1 as Int32,
ByVal nData2 as Int32,
ByVal pBufferUnicode as IntPtr,
ByVal nBufferLength as Int32
)
|
|
[C#]
public delegate void CallbackForCastingEvents (
enumCastingEvents nEvent,
Int32 nCastingUniqueId,
Int32 nData1,
Int32 nData2,
IntPtr pBufferUnicode,
Int32 nBufferLength
)
|
|
[C++]
public delegate void CallbackForCastingEvents (
enumCastingEvents nEvent,
Int32 nCastingUniqueId,
Int32 nData1,
Int32 nData2,
IntPtr pBufferUnicode,
Int32 nBufferLength
)
|
|
Parameter
|
Description
|
|
|
nEvent
|
The type of event.
Supported values, with related parameters, are the following:
Mnemonic constant
|
Value
|
Meaning
|
EV_CASTING_PLAYER_START
|
1
|
Alternative to the CastingPlayerStart event.
Occurs when a player, through a call to the the CastingStart method, starts a casting session previously created by one between the CastingCreateFromPlayer, CastingWmaPubPointOpenForPlayer or CastingWmaNetworkOpenForPlayer methods.
Involved data parameters: none
|
EV_CASTING_PLAYER_PERC
|
2
|
Alternative to the CastingPlayerPerc event.
Occurs during a player-based casting session to inform about the advancement percentage.
Involved data parameters:
nData1: Advancement of the casting session expressed in percentage
|
EV_CASTING_PLAYER_DONE
|
3
|
Alternative to the CastingPlayerDone event.
Occurs when a player completes a casting session previously created by one between the CastingCreateFromStreamMixer, CastingWmaPubPointOpenForStreamMixer or CastingWmaNetworkOpenForStreamMixer methods and started through the CastingStart method .
Involved data parameters:
nData1: The result of the operation. See the LastError property for details about the returned result code.
|
EV_CASTING_STREAM_MIXER_START
|
4
|
Alternative to the CastingStreamMixerStart event.
Occurs when a stream mixer, through a call to the the CastingStart method, starts a casting session previously created by one between the CastingCreateFromStreamMixer, CastingWmaPubPointOpenForStreamMixer or CastingWmaNetworkOpenForStreamMixer methods.
|
EV_CASTING_STREAM_MIXER_STOP
|
5
|
Alternative to the CastingStreamMixerStop event.
Occurs when a stream mixer, through a call to the the CastingStop method, stops a casting session previously created by one between the CastingCreateFromStreamMixer, CastingWmaPubPointOpenForStreamMixer or CastingWmaNetworkOpenForStreamMixer methods and started through the CastingStart method .
This event may also occur if the connection with the server should die for external reasons: in this case the error code would be reported inside the nData1 parameter.
Involved data parameters:
nData1: The result of the operation. See the LastError property for details about the returned result code. In case this parameter should indicate that an error occurred, be sure to close the casting session by calling the CastingStop method.
|
EV_CASTING_WMA_CLIENT_CONNECT
|
6
|
Alternative to the WmaNetworkClientConnect event.
Occurs when a client is connected/disconnected on a WMA network session created through a call to CastingWmaNetworkOpenForStreamMixer or CastingWmaNetworkOpenForPlayer methods.
Involved data parameters:
nData1: Boolean value that specifies if the client was connected or disconnected.
Supported values are the following:
Value
|
Meaning
|
0
|
The client was disconnected
|
1
|
The client was connected
|
pBufferUnicode: String representing the IP address of the connected client.
|
EV_CASTING_LOOPBACK_START
|
7
|
Alternative to the CastingWasapiLoopbackStart event.
Occurs when a WASAPI loopack device, through a call to the the CastingStart method, starts a casting session previously created by one between the CastingCreateFromWasapiLoopback, CastingWmaPubPointOpenFromWasapiLoopback or CastingWmaNetworkOpenFromWasapiLoopback methods.
This event is only intended for usage with Windows Vista and later versions.
|
EV_CASTING_LOOPBACK_STOP
|
8
|
Alternative to the CastingWasapiLoopbackStop event.
Occurs when a WASAPI loopack device, through a call to the the CastingStop method, stops a casting session previously created by one between the CastingCreateFromStreamMixer, CastingWmaPubPointOpenForStreamMixer or CastingWmaNetworkOpenForStreamMixer methods and started through the CastingStart method .
This event may also occur if the connection with the server should die for external reasons: in this case the error code would be reported inside the nResult parameter.
Involved data parameters:
nData1: The result of the operation. See the LastError property for details about the returned result code. In case this parameter should indicate that an error occurred, be sure to close the casting session by calling the CastingStop method.
This event is only intended for usage with Windows Vista and later versions.
|
|
nCastingUniqueId
|
Unique identifier of the casting session returned by a previous call to CastingCreateFromPlayer, CastingWmaPubPointOpenForPlayer or CastingWmaNetworkOpenForPlayer methods.
|
nData1
|
Number representing the first parameter related to the event (see the events table above for details)
|
nData2
|
Number representing the second parameter related to the event (see the events table above for details)
|
pBufferUnicode
|
Pointer to a buffer containing a string of Unicode characters with text information about the event. Below a couple of snippets that show how to convert the buffer contents into a .NET string through marshaling:
Visual Basic .NET
|
Imports System.Runtime.InteropServices
Dim strInfo As String = Marshal.PtrToStringUni(pBufferUnicode, nBufferLength)
strInfo = strInfo.Trim()
|
Visual C#
|
using System.Runtime.InteropServices;
string strInfo = Marshal.PtrToStringUni(pBufferUnicode, nBufferLength);
strInfo = strInfo.Trim();
|
|
nBufferLength
|
The length in characters of the buffer above
|