Share via


AVSampleBufferAudioRenderer.Notifications.ObserveAudioRendererWasFlushedAutomatically Metodo

Definizione

Overload

ObserveAudioRendererWasFlushedAutomatically(EventHandler<AudioRendererWasFlushedAutomaticallyEventArgs>)

Notifica fortemente tipizzata per la AudioRendererWasFlushedAutomaticallyNotification costante.

ObserveAudioRendererWasFlushedAutomatically(NSObject, EventHandler<AudioRendererWasFlushedAutomaticallyEventArgs>)

Notifica fortemente tipizzata per la AudioRendererWasFlushedAutomaticallyNotification costante.

ObserveAudioRendererWasFlushedAutomatically(EventHandler<AudioRendererWasFlushedAutomaticallyEventArgs>)

Notifica fortemente tipizzata per la AudioRendererWasFlushedAutomaticallyNotification costante.

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

Parametri

handler
EventHandler<AudioRendererWasFlushedAutomaticallyEventArgs>

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 = AVSampleBufferAudioRenderer.Notifications.ObserveAudioRendererWasFlushedAutomatically ((sender, args) => {
    /* Access strongly typed args */
    Console.WriteLine ("Notification: {0}", args.Notification);

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

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

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

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

void Setup ()
{
    notification = AVSampleBufferAudioRenderer.Notifications.ObserveAudioRendererWasFlushedAutomatically (Callback);
}

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

Si applica a

ObserveAudioRendererWasFlushedAutomatically(NSObject, EventHandler<AudioRendererWasFlushedAutomaticallyEventArgs>)

Notifica fortemente tipizzata per la AudioRendererWasFlushedAutomaticallyNotification costante.

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

Parametri

objectToObserve
NSObject

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 AudioRendererWasFlushedAutomaticallyNotification le notifiche.

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

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

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

Si applica a