Share via


AVPlayerItem.Notifications.ObserveItemFailedToPlayToEndTime Metodo

Definizione

Overload

ObserveItemFailedToPlayToEndTime(EventHandler<AVPlayerItemErrorEventArgs>)

Notifica fortemente tipizzata per la ItemFailedToPlayToEndTimeNotification costante.

ObserveItemFailedToPlayToEndTime(NSObject, EventHandler<AVPlayerItemErrorEventArgs>)

Notifica fortemente tipizzata per la ItemFailedToPlayToEndTimeNotification costante.

ObserveItemFailedToPlayToEndTime(EventHandler<AVPlayerItemErrorEventArgs>)

Notifica fortemente tipizzata per la ItemFailedToPlayToEndTimeNotification costante.

public static Foundation.NSObject ObserveItemFailedToPlayToEndTime (EventHandler<AVFoundation.AVPlayerItemErrorEventArgs> handler);
static member ObserveItemFailedToPlayToEndTime : EventHandler<AVFoundation.AVPlayerItemErrorEventArgs> -> Foundation.NSObject

Parametri

handler
EventHandler<AVPlayerItemErrorEventArgs>

Metodo da richiamare quando viene inviata la notifica.

Restituisce

Oggetto token che può essere usato per interrompere la ricezione delle notifiche eliminandolo o passandolo a RemoveObservers(IEnumerable<NSObject>)

Commenti

L'esempio seguente illustra come gli sviluppatori possono usare questo metodo nel codice:

//
// 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 ();
}

Si applica a

ObserveItemFailedToPlayToEndTime(NSObject, EventHandler<AVPlayerItemErrorEventArgs>)

Notifica fortemente tipizzata per la ItemFailedToPlayToEndTimeNotification costante.

public static Foundation.NSObject ObserveItemFailedToPlayToEndTime (Foundation.NSObject objectToObserve, EventHandler<AVFoundation.AVPlayerItemErrorEventArgs> handler);
static member ObserveItemFailedToPlayToEndTime : Foundation.NSObject * EventHandler<AVFoundation.AVPlayerItemErrorEventArgs> -> Foundation.NSObject

Parametri

objectToObserve
NSObject

Oggetto specifico da osservare.

handler
EventHandler<AVPlayerItemErrorEventArgs>

Gestore che risponde alla notifica quando si verifica.

Restituisce

Oggetto token che può essere usato per interrompere la ricezione delle notifiche eliminandolo o passandolo a RemoveObservers(IEnumerable<NSObject>)

Commenti

Questo metodo può essere usato per sottoscrivere ItemFailedToPlayToEndTimeNotification le notifiche.

// 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 ();

Si applica a