Condividi tramite


MPMoviePlayerController.Notifications.ObserveTimedMetadataUpdated Metodo

Definizione

Overload

ObserveTimedMetadataUpdated(NSObject, EventHandler<MPMoviePlayerTimedMetadataEventArgs>)

Notifica fortemente tipizzata per la TimedMetadataUpdatedNotification costante.

ObserveTimedMetadataUpdated(EventHandler<MPMoviePlayerTimedMetadataEventArgs>)

Notifica fortemente tipizzata per la TimedMetadataUpdatedNotification costante.

ObserveTimedMetadataUpdated(NSObject, EventHandler<MPMoviePlayerTimedMetadataEventArgs>)

Notifica fortemente tipizzata per la TimedMetadataUpdatedNotification costante.

public static Foundation.NSObject ObserveTimedMetadataUpdated (Foundation.NSObject objectToObserve, EventHandler<MediaPlayer.MPMoviePlayerTimedMetadataEventArgs> handler);
static member ObserveTimedMetadataUpdated : Foundation.NSObject * EventHandler<MediaPlayer.MPMoviePlayerTimedMetadataEventArgs> -> Foundation.NSObject

Parametri

objectToObserve
NSObject

Oggetto da osservare.

handler
EventHandler<MPMoviePlayerTimedMetadataEventArgs>

Metodo da richiamare quando viene pubblicata la notifica.

Restituisce

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

Commenti

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

// Listen to all notifications posted for any object
var token = MPMoviePlayerController.Notifications.ObserveTimedMetadataUpdated ((notification) => {
	Console.WriteLine ("Observed TimedMetadataUpdatedNotification!");
};

// Listen to all notifications posted for a single object
var token = MPMoviePlayerController.Notifications.ObserveTimedMetadataUpdated (objectToObserve, (notification) => {
	Console.WriteLine ($"Observed TimedMetadataUpdatedNotification for {nameof (objectToObserve)}!");
};

// Stop listening for notifications
token.Dispose ();

Si applica a

ObserveTimedMetadataUpdated(EventHandler<MPMoviePlayerTimedMetadataEventArgs>)

Notifica fortemente tipizzata per la TimedMetadataUpdatedNotification costante.

public static Foundation.NSObject ObserveTimedMetadataUpdated (EventHandler<MediaPlayer.MPMoviePlayerTimedMetadataEventArgs> handler);
static member ObserveTimedMetadataUpdated : EventHandler<MediaPlayer.MPMoviePlayerTimedMetadataEventArgs> -> Foundation.NSObject

Parametri

handler
EventHandler<MPMoviePlayerTimedMetadataEventArgs>

Metodo da richiamare quando viene pubblicata la notifica.

Restituisce

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

Commenti

Nell'esempio seguente viene illustrato come gli sviluppatori possono usare questo metodo nel codice:

//
// Lambda style
//

// listening
notification = MPMoviePlayerController.Notifications.ObserveTimedMetadataUpdated ((sender, args) => {
    /* Access strongly typed args */
    Console.WriteLine ("Notification: {0}", args.Notification);

    Console.WriteLine ("TimedMetadata", args.TimedMetadata);
});

// To stop listening:
notification.Dispose ();

//
//Method style
//
NSObject notification;
void Callback (object sender, MediaPlayer.MPMoviePlayerTimedMetadataEventArgs args)
{
    // Access strongly typed args
    Console.WriteLine ("Notification: {0}", args.Notification);

    Console.WriteLine ("TimedMetadata", args.TimedMetadata);
}

void Setup ()
{
    notification = MPMoviePlayerController.Notifications.ObserveTimedMetadataUpdated (Callback);
}

void Teardown ()
{
    notification.Dispose ();
}

Si applica a