MPMoviePlayerController.Notifications.ObserveTimedMetadataUpdated Méthode

Définition

Surcharges

ObserveTimedMetadataUpdated(NSObject, EventHandler<MPMoviePlayerTimedMetadataEventArgs>)

Notification fortement typée pour la TimedMetadataUpdatedNotification constante.

ObserveTimedMetadataUpdated(EventHandler<MPMoviePlayerTimedMetadataEventArgs>)

Notification fortement typée pour la TimedMetadataUpdatedNotification constante.

ObserveTimedMetadataUpdated(NSObject, EventHandler<MPMoviePlayerTimedMetadataEventArgs>)

Notification fortement typée pour la TimedMetadataUpdatedNotification constante.

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

Paramètres

objectToObserve
NSObject

Objet à observer.

handler
EventHandler<MPMoviePlayerTimedMetadataEventArgs>

Méthode à appeler lorsque la notification est publiée.

Retours

Objet jeton qui peut être utilisé pour arrêter de recevoir des notifications en le supprimant ou en le transmettant à RemoveObservers(IEnumerable<NSObject>)

Remarques

Cette méthode peut être utilisée pour TimedMetadataUpdatedNotification s’abonner aux notifications.

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

S’applique à

ObserveTimedMetadataUpdated(EventHandler<MPMoviePlayerTimedMetadataEventArgs>)

Notification fortement typée pour la TimedMetadataUpdatedNotification constante.

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

Paramètres

handler
EventHandler<MPMoviePlayerTimedMetadataEventArgs>

Méthode à appeler lorsque la notification est publiée.

Retours

Objet jeton qui peut être utilisé pour arrêter de recevoir des notifications en le supprimant ou en le transmettant à RemoveObservers(IEnumerable<NSObject>)

Remarques

L’exemple suivant montre comment les développeurs peuvent utiliser cette méthode dans leur code :

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

S’applique à