2

Google Cast 프레임 워크를 사용하는 iOS Obj-C 앱을 개발하고 있습니다. iOS - MPNowPlayingInfoCenter와 Chromecast를 통합하여 화면 잠금 제어 제공

나는 잠금 화면 컨트롤이 나는 배경 처리를 지원하기 위해 내 응용 프로그램에 올바른 사용 권한을 추가 한 MPNowPlayingInfoCenter

를 통해 작업을 진행하려합니다.

나는과 같이 캐스트 장치를 초기화하는 오전 : 나는 수신기에 미디어를 실행하면

self.chromeCastDeviceManager = [[GCKDeviceManager alloc] initWithDevice:self.selectedChromeCastDevice clientPackageName:[info objectForKey:@"CFBundleIdentifier"] ignoreAppStateNotifications:YES];

가, 내가 성공적으로 재생 응답을받을 때 MPNowPlayingInfoCenter를 초기화하기 위해서하려고합니다.

NSInteger result = [_castControlChannel play]; 

if (!result) { 
    //launch has worked 
    [[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]; 
    } 
} 
나는 그들이 AVKit/ AVFoundation를 통해로드 할 때 MPNowPlayingInfoCenter는 미디어 세션에 대한 컨트롤을 제공 믿고 시작하고

? 이 말을하는 것이 맞습니까?

사실이라면 Chromecast의 play method으로 NCPT를 길게 AVKit/ AVFoundation 길이로 만들 수 있습니다. 그런 다음 AVPlayer를 숨기고 조용히합니다. 그런 다음 미디어 컨트롤을 잡아 Chromecast로 리디렉션 할 수 있습니까?

iOS의 유튜브 앱을 이렇게하는 것으로 추측합니까? Netflix와 Spotify는 둘 다 chromecast로 캐스팅 할 때 lockscreen 컨트롤을 지원하지 않습니다.

+0

스포티 파이는이 기능을 가지고, 나는 그것에 트릭은,이 문제에 어떤 새로운 개발가 뭐죠 찾을 가려움입니까? –

답변

0

나는 플레이어 화면을 잠금 화면에 표시하는 솔루션을 개발했습니다. 나는 해킹을 사용하여 method_exchangeImplementations와 음소거 같은 사운드를 사용하여 플레이어를 놀리고 모의합니다. 나는이 게시물에 대답 한

Does google chromecast iOS SDK support lock screen controls?

지금까지 괜찮 작동하지만 아마도 여전히 개선이 필요합니다.

https://github.com/peantunes/google-cast-ios-lock-screen를 살펴 보자