我正在开发一款应用程序。我正在使用AVPlayer进行音频。我想通过控制屏幕按钮控制音频。我不知道如何注册远程事件。
发布于 2015-08-31 20:09:47
您应该使用的代码是:
player.ReplaceCurrentItemWithPlayerItem(streamingItem);
streamingItem.AddObserver(this, new NSString("status"), NSKeyValueObservingOptions.New, player.Handle);
streamingItem.AddObserver(this, new NSString("loadedTimeRanges"), NSKeyValueObservingOptions.Initial | NSKeyValueObservingOptions.New, player.Handle);
player.CurrentItem.SeekingWaitsForVideoCompositionRendering = true;
player.CurrentItem.AddObserver(this, (NSString)"status", NSKeyValueObservingOptions.New |
NSKeyValueObservingOptions.Initial, StatusObservationContext.Handle);
NSNotificationCenter.DefaultCenter.AddObserver(AVPlayerItem.DidPlayToEndTimeNotification, async (notification) =>
{
await PlayNext();
}, player.CurrentItem);
player.Play();https://stackoverflow.com/questions/32309548
复制相似问题