ios - google chromecast iOS SDK 是否支持锁屏控件?

标签 ios iphone chromecast google-cast mpnowplayinginfocenter

我尝试使用适用于 iOS (2.1.0) 的最新 GoogleCast 框架为 google Chromecast 视频流应用程序实现锁屏控制。

我已经更正了示例 Chromecast 应用 - https://github.com/googlecast/CastVideos-ios 已将 UIBackgroundModes 行添加到 Info.plist enter image description here 添加了 MediaPlayer 框架。 并在 ChromecastDeviceController.m 中添加如下代码

#import <MediaPlayer/MPNowPlayingInfoCenter.h>
#import <MediaPlayer/MPMediaItem.h>
.......

- (BOOL)loadMedia:(NSURL *)url
     thumbnailURL:(NSURL *)thumbnailURL
            title:(NSString *)title
         subtitle:(NSString *)subtitle
         mimeType:(NSString *)mimeType
        startTime:(NSTimeInterval)startTime
         autoPlay:(BOOL)autoPlay {

    .....

    [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];

    Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter");

    if (playingInfoCenter) {

        NSDictionary *songInfo = [NSDictionary dictionaryWithObjectsAndKeys:
                                  @"Test artist", MPMediaItemPropertyArtist,
                                  @"Test title", MPMediaItemPropertyTitle,
                                  @"Test Album", MPMediaItemPropertyAlbumTitle,
                                  nil];
        [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:songInfo];
    }

  return YES;
}

但是我在直播的时候锁屏界面看不到任何控件。

从这些来源中,我发现对于以前版本的 Chromecast iOS SDK (2.0),无法在锁定屏幕上显示任何控件,因为它关闭了进入后台模式的套接字。

ChromeCast background video playback support iOS

Google Chromecast SDK TearDown in background

https://code.google.com/p/google-cast-sdk/issues/detail?id=138

Cast SDK 2.1.0 还是一样吗?或者我做错了什么,实际上可以在 chromecasting 期间在锁定屏幕上显示控件? 谢谢。

最佳答案

当您锁定屏幕时,当前的 iOS Cast SDK 会断开套接字,因此您目前无法实现该功能。

关于ios - google chromecast iOS SDK 是否支持锁屏控件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22824683/

相关文章:

javascript - iOS 视频播放器播放按钮在 15 个视频后禁用

ios - 在 React Native 中居中 PickerIOS

iphone - 如何找出其他哪些 UIScrollView 干扰了 scrollsToTop?

objective-c - 在 opentok ios sdk 中,调用者没有从接收者那里收到结束调用事件

ios - 我怎样才能访问 Introductory Overlay?

ios - 我的用户默认设置不保存我的 slider 值 - Swift 3

ios - Swift - jonkykong SideMenu - 将 View 推到菜单顶部

android - chromecast - 基于 chromecast 示例实现 'play OR enqueue'

chromecast - CAF 接收器 : How to change the volume/mute?

ios - 磁盘上的 PFFile 位置