亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

iOS app如何在進(jìn)入背景模式的時(shí)候依然播放音樂
伊謝爾倫
伊謝爾倫 2017-04-17 11:11:41
0
1
1107

iOS app如何在進(jìn)入背景模式的時(shí)候依然播放音樂

就像douban電臺(tái)那樣, 不但在退出程序以后依然有音樂播放, 就連雙擊home按鈕以后左邊的音樂控制欄都變成douban電臺(tái)的圖標(biāo)了, 請(qǐng)問(wèn)這是如何做到的?

伊謝爾倫
伊謝爾倫

小伙看你根骨奇佳,潛力無(wú)限,來(lái)學(xué)PHP伐。

reply all(1)
洪濤

1. Background playback is done by adding Info.plist to UIBackgroundModes in audio for reference https://developer.apple.com/library/i...

2. "Even after double-clicking the home button, the music control bar on the left turns into the icon of Douban Radio." This is to register an object in your own program as a responder to the corresponding remote control message. When the user clicks prev, next, play/pause in the control bar, the program will receive the corresponding message. When receiving the message, you must control the playback accordingly.
Register the responder in the view controller:

- (void) viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
    [self becomeFirstResponder];
}

- (void) viewWillDisappear:(BOOL)animated {
    [[UIApplication sharedApplication] endReceivingRemoteControlEvents];
    [self resignFirstResponder]; 
    [super viewWillDisappear:animated];
}

- (BOOL) canBecomeFirstResponder {
    return YES;
}

At the same time, the view controller needs to implement:

- (void) remoteControlReceivedWithEvent: (UIEvent *) receivedEvent;

3. Making the control bar display a title is another matter. You need to call the media center interface in the program to set the title and cover. Referencehttp://stackoverflow.com/questions/10...

4. Getting the album cover and title from ID3 is the fourth thing. .

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template