Platform SDK: Broadcast Architecture |
The Video control uses a cooperative mechanism to prevent device conflicts. This mechanism prevents multiple instances of the Video control from attempting to control a particular device at the same time, which would cause unpredictable results.
The BPCVid.GotControl and BPCVid.LostControl events are used to inform an application that it has control or must relinquish control of a particular device. For example, if your application needs to receive input from a particular device through the Video control, it must first request control of the device by setting the input property of the Video control equal to the device. Your application should then wait until it receives a GotControl notification before it uses the device. If an application attempts to access a device before it has control of that device, unexpected behavior can occur.
Similarly, if your application receives a LostControl notification, it should immediately stop using the device in question until it can regain control. Otherwise, unexpected behavior may occur when multiple applications access the device.
Thus, in order to handle device contention, your application must implement GotControl and LostControl event handlers.
The device contention protocol also implements priority levels for application access to devices. These priority levels are used when two applications are in contention for a device. In this case, control is given to the application with higher priority. If both applications have equal priority, the application that currently has control of the device retains control. You can set the priority for the instance of the Video control that your application uses by setting the BPCVid.Priority property.