AVSampleBufferAudioRenderer.AudioRendererWasFlushedAutomaticallyNotification 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
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
屬性值
NSString 常數應作為 NSNotificationCenter 的權杖使用。
- 屬性
備註
這個常數可以與 搭配 NSNotificationCenter 使用,以註冊此通知的接聽程式。 這是 NSString 而不是字串,因為這些值可以當做某些原生程式庫中的標記使用,而不是單純用於其實際字串內容。 回呼的 'notification' 參數包含通知類型特有的額外資訊。
若要訂閱此通知,開發人員可以使用方便 AVSampleBufferAudioRenderer.Notifications 的 。 ObserveAudioRendererWasFlushedAutomatically 方法可提供通知參數的強型別存取。
下列範例示範如何使用強型別的 Notifications 類別,將猜測從通知中的可用屬性中取出:
//
// 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 ();
}
下列範例示範如何搭配 DefaultCenter API 使用通知:
// 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);
}