Google chromecast iOS SDK是否支持锁定屏幕控件? [英] Does google chromecast iOS SDK support lock screen controls?

查看:103
本文介绍了Google chromecast iOS SDK是否支持锁定屏幕控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



我已更正示例Chromecast应用-



后台的Google Chromecast SDK TearDown



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



Cast SDK 2.1.0是否仍然相同?还是我做错了什么,实际上可以在Chromecast中在锁定屏幕上显示控件吗?
谢谢。

解决方案

当前的iOS Cast SDK在锁定屏幕时会断开套接字连接,因此当前无法实现那。


I've tried to implement lock screen controls for google Chromecast video streaming app with the latest GoogleCast framework for iOS (2.1.0).

I've corrected the example Chromecast app - https://github.com/googlecast/CastVideos-ios Have added UIBackgroundModes row to the Info.plist Added MediaPlayer framework. And added the following code to 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;
}

But I don't see any controls on the lock screen during broadcasting.

From these sources I see that it wasn't possible to show any controls on the lock screen for the previous version of Chromecast iOS SDK (2.0), because it Closes sockets going to background mode.

ChromeCast background video playback support iOS

Google Chromecast SDK TearDown in background

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

Is it still the same for Cast SDK 2.1.0? Or I'm doing something wrong and actually it's possible to show controls on the lock screen during chromecasting? Thanks.

解决方案

The current iOS Cast SDK disconnects the socket when you lock your screen, so you cannot currently implement that.

这篇关于Google chromecast iOS SDK是否支持锁定屏幕控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆