Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I tried some ways which was found in the net,but it didn't work.Some one had used this way to solute his question.I didn’t know why.</p> <p>the following is my code:</p> <pre><code>- (void)applicationDidEnterBackground:(UIApplication *)application { [application beginReceivingRemoteControlEvents]; [self updateUserLocation]; } - (void)updateUserLocation { if (!pCotnroller1) { // pCotnroller1 = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://r.yhiker.com:9001/0086/32/05/PP0041/Data/13/00863205PP0041013_24Kbps.mp3"]]; NSString *audioDiskPath = [HelpTools returnSpotAudioDiskPath:@"00863205PP0041013"]; pCotnroller1 = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:audioDiskPath/*@"/var/mobile/Applications/E7A06CB2-0856-407D-ABA1-2A846B65CD9D/Library/Caches/Data/0086/32/05/PP0041/Data/13/00863205060005016_24Kbps.mp3"*/]]; pCotnroller1.shouldAutoplay = YES; if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) { [pCotnroller1 play]; NSLog(@"进入后台"); UIApplication *app = [UIApplication sharedApplication]; UIBackgroundTaskIdentifier taskID = [app beginBackgroundTaskWithExpirationHandler:nil]; if (bgTask != UIBackgroundTaskInvalid) { [app endBackgroundTask:bgTask]; NSLog(@"允许后台播放"); } bgTask = taskID; } else { NSLog(@"飞后台进行播放"); [pCotnroller1 play]; } } } </code></pre> <p>the console print: 2013-03-18 16:20:11.844 Sz[1665:907] [MPAVController] Autoplay: Disabling autoplay for pause 2013-03-18 16:20:11.845 Sz[1665:907] [MPAVController] Autoplay: Disabling autoplay 2013-03-18 16:20:13.489 Sz[1665:907] 文件存在 2013-03-18 16:20:18.017 Sz[1665:907] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0) 2013-03-18 16:20:18.998 Sz[1665:907] 进入后台 2013-03-18 16:20:21.269 Sz[1665:907] 播放地址 2013-03-18 16:20:26.251 Sz[1665:907] [MPAVController] Autoplay: Enabling autoplay 2013-03-18 16:20:26.307 Sz[1665:907] [MPAVController] Autoplay: Likely to keep up or full buffer: 0 2013-03-18 16:20:26.309 Sz[1665:907] [MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up. 2013-03-18 16:20:26.319 Sz[1665:907] [MPAVController] Autoplay: Enabling autoplay 2013-03-18 16:20:26.338 Sz[1665:907] [MPCloudAssetDownloadController] Prioritization requested for media item ID: 0</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload