AVSampleBufferAudioRenderer.Notifications.ObserveAudioRendererWasFlushedAutomatically Method

Definition

Overloads

ObserveAudioRendererWasFlushedAutomatically(EventHandler<AudioRendererWasFlushedAutomaticallyEventArgs>)

Strongly typed notification for the AudioRendererWasFlushedAutomaticallyNotification constant.

ObserveAudioRendererWasFlushedAutomatically(NSObject, EventHandler<AudioRendererWasFlushedAutomaticallyEventArgs>)

Strongly typed notification for the AudioRendererWasFlushedAutomaticallyNotification constant.

ObserveAudioRendererWasFlushedAutomatically(EventHandler<AudioRendererWasFlushedAutomaticallyEventArgs>)

Strongly typed notification for the AudioRendererWasFlushedAutomaticallyNotification constant.

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

Parameters

handler
EventHandler<AudioRendererWasFlushedAutomaticallyEventArgs>

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

Applies to

ObserveAudioRendererWasFlushedAutomatically(NSObject, EventHandler<AudioRendererWasFlushedAutomaticallyEventArgs>)

Strongly typed notification for the AudioRendererWasFlushedAutomaticallyNotification constant.

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

Parameters

objectToObserve
NSObject

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 AudioRendererWasFlushedAutomaticallyNotification notifications.

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

Applies to