Share via


AVSampleBufferAudioRenderer.AudioRendererWasFlushedAutomaticallyNotification Proprietà

Definizione

Costante di notifica per AudioRendererWasFlushedAutomatically

[Foundation.Advice("Use AVSampleBufferAudioRenderer.Notifications.ObserveAudioRendererWasFlushedAutomatically helper method instead.")]
[Foundation.Field("AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification", "AVFoundation")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.TvOS, 11, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.MacOSX, 10, 13, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 11, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)]
public static Foundation.NSString AudioRendererWasFlushedAutomaticallyNotification { [ObjCRuntime.Introduced(ObjCRuntime.PlatformName.TvOS, 11, 0, ObjCRuntime.PlatformArchitecture.All, null)] [ObjCRuntime.Introduced(ObjCRuntime.PlatformName.MacOSX, 10, 13, ObjCRuntime.PlatformArchitecture.All, null)] [ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 11, 0, ObjCRuntime.PlatformArchitecture.All, null)] [ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)] get; }
member this.AudioRendererWasFlushedAutomaticallyNotification : Foundation.NSString

Valore della proprietà

La costante NSString deve essere usata come token per NSNotificationCenter.

Attributi

Commenti

Questa costante può essere usata con per NSNotificationCenter registrare un listener per questa notifica. Si tratta di un NSString anziché di una stringa, perché questi valori possono essere usati come token in alcune librerie native anziché essere usati esclusivamente per il contenuto stringa effettivo. Il parametro 'notification' del callback contiene informazioni aggiuntive specifiche per il tipo di notifica.

Per sottoscrivere questa notifica, gli sviluppatori possono usare il metodo . pratico AVSampleBufferAudioRenderer.NotificationsObserveAudioRendererWasFlushedAutomatically che offre accesso fortemente tipizzato ai parametri della notifica.

Nell'esempio seguente viene illustrato come usare la classe Notifiche fortemente tipizzata, per eseguire i tentativi di indovinare le proprietà disponibili nella notifica:

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

Nell'esempio seguente viene illustrato come usare la notifica con l'API DefaultCenter:

// Lambda style
NSNotificationCenter.DefaultCenter.AddObserver (
        AVSampleBufferAudioRenderer.AudioRendererWasFlushedAutomaticallyNotification, (notification) => {Console.WriteLine ("Received the notification AVSampleBufferAudioRenderer", notification); }


// Method style
void Callback (NSNotification notification)
{
    Console.WriteLine ("Received a notification AVSampleBufferAudioRenderer", notification);
}

void Setup ()
{
    NSNotificationCenter.DefaultCenter.AddObserver (AVSampleBufferAudioRenderer.AudioRendererWasFlushedAutomaticallyNotification, Callback);
}

Si applica a