gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 05:04:28 28 4
gpt4 key购买 nike

我尝试使用适用于 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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com