AVPlayerItem.Notifications.ObserveItemFailedToPlayToEndTime Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ObserveItemFailedToPlayToEndTime(EventHandler<AVPlayerItemErrorEventArgs>) |
Strongly typed notification for the ItemFailedToPlayToEndTimeNotification constant. |
ObserveItemFailedToPlayToEndTime(NSObject, EventHandler<AVPlayerItemErrorEventArgs>) |
Strongly typed notification for the ItemFailedToPlayToEndTimeNotification constant. |
ObserveItemFailedToPlayToEndTime(EventHandler<AVPlayerItemErrorEventArgs>)
Strongly typed notification for the ItemFailedToPlayToEndTimeNotification constant.
public static Foundation.NSObject ObserveItemFailedToPlayToEndTime (EventHandler<AVFoundation.AVPlayerItemErrorEventArgs> handler);
static member ObserveItemFailedToPlayToEndTime : EventHandler<AVFoundation.AVPlayerItemErrorEventArgs> -> Foundation.NSObject
Parameters
- handler
- EventHandler<AVPlayerItemErrorEventArgs>
Method to invoke when the notification is posted.
Returns
Token object that can be used to stop receiving notifications by either disposing it or passing it to RemoveObservers(IEnumerable<NSObject>)
Remarks
The following example shows how developers can use this method in their code:
//
// Lambda style
//
// listening
notification = AVPlayerItem.Notifications.ObserveItemFailedToPlayToEndTime ((sender, args) => {
/* Access strongly typed args */
Console.WriteLine ("Notification: {0}", args.Notification);
Console.WriteLine ("Error", args.Error);
});
// To stop listening:
notification.Dispose ();
//
//Method style
//
NSObject notification;
void Callback (object sender, AVFoundation.AVPlayerItemErrorEventArgs args)
{
// Access strongly typed args
Console.WriteLine ("Notification: {0}", args.Notification);
Console.WriteLine ("Error", args.Error);
}
void Setup ()
{
notification = AVPlayerItem.Notifications.ObserveItemFailedToPlayToEndTime (Callback);
}
void Teardown ()
{
notification.Dispose ();
}
Applies to
ObserveItemFailedToPlayToEndTime(NSObject, EventHandler<AVPlayerItemErrorEventArgs>)
Strongly typed notification for the ItemFailedToPlayToEndTimeNotification constant.
public static Foundation.NSObject ObserveItemFailedToPlayToEndTime (Foundation.NSObject objectToObserve, EventHandler<AVFoundation.AVPlayerItemErrorEventArgs> handler);
static member ObserveItemFailedToPlayToEndTime : Foundation.NSObject * EventHandler<AVFoundation.AVPlayerItemErrorEventArgs> -> Foundation.NSObject
Parameters
- objectToObserve
- NSObject
The specific object to observe.
- handler
- EventHandler<AVPlayerItemErrorEventArgs>
The handler that responds to the notification when it occurs.
Returns
Token object that can be used to stop receiving notifications by either disposing it or passing it to RemoveObservers(IEnumerable<NSObject>)
Remarks
This method can be used to subscribe for ItemFailedToPlayToEndTimeNotification notifications.
// Listen to all notifications posted for any object
var token = AVPlayerItem.Notifications.ObserveItemFailedToPlayToEndTime ((notification) => {
Console.WriteLine ("Observed ItemFailedToPlayToEndTimeNotification!");
};
// Listen to all notifications posted for a single object
var token = AVPlayerItem.Notifications.ObserveItemFailedToPlayToEndTime (objectToObserve, (notification) => {
Console.WriteLine ($"Observed ItemFailedToPlayToEndTimeNotification for {nameof (objectToObserve)}!");
};
// Stop listening for notifications
token.Dispose ();