1. <small id='4XKrs'></small><noframes id='4XKrs'>

  2. <i id='4XKrs'><tr id='4XKrs'><dt id='4XKrs'><q id='4XKrs'><span id='4XKrs'><b id='4XKrs'><form id='4XKrs'><ins id='4XKrs'></ins><ul id='4XKrs'></ul><sub id='4XKrs'></sub></form><legend id='4XKrs'></legend><bdo id='4XKrs'><pre id='4XKrs'><center id='4XKrs'></center></pre></bdo></b><th id='4XKrs'></th></span></q></dt></tr></i><div id='4XKrs'><tfoot id='4XKrs'></tfoot><dl id='4XKrs'><fieldset id='4XKrs'></fieldset></dl></div>

    • <bdo id='4XKrs'></bdo><ul id='4XKrs'></ul>
    <tfoot id='4XKrs'></tfoot>

  3. <legend id='4XKrs'><style id='4XKrs'><dir id='4XKrs'><q id='4XKrs'></q></dir></style></legend>

      在 ios 5 中的 MP 音乐播放器控制器中出现错误的播

      时间:2023-06-01

      <small id='WH4We'></small><noframes id='WH4We'>

    1. <tfoot id='WH4We'></tfoot>

        <tbody id='WH4We'></tbody>
        <bdo id='WH4We'></bdo><ul id='WH4We'></ul>
      • <legend id='WH4We'><style id='WH4We'><dir id='WH4We'><q id='WH4We'></q></dir></style></legend>

              <i id='WH4We'><tr id='WH4We'><dt id='WH4We'><q id='WH4We'><span id='WH4We'><b id='WH4We'><form id='WH4We'><ins id='WH4We'></ins><ul id='WH4We'></ul><sub id='WH4We'></sub></form><legend id='WH4We'></legend><bdo id='WH4We'><pre id='WH4We'><center id='WH4We'></center></pre></bdo></b><th id='WH4We'></th></span></q></dt></tr></i><div id='WH4We'><tfoot id='WH4We'></tfoot><dl id='WH4We'><fieldset id='WH4We'></fieldset></dl></div>

              • 本文介绍了在 ios 5 中的 MP 音乐播放器控制器中出现错误的播放状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我在 MP 音乐播放器中的播放状态错误.在播放歌曲时,我处于暂停状态.我的应用程序在 ios 4 中运行良好.但我在 ios 5 中遇到了这个问题.谁能帮帮我??

                i am getting wrong playback state in MP music player. while playing a song i am getting pause state. My app is working fine in ios 4.but i am having this issue in ios 5. can anybody Help me ??

                我的代码在这里.

                [musicPlayer stop];
                if (userMediaItemCollection)
                {
                   userMediaItemCollection=nil; 
                }
                musicPlayer.nowPlayingItem=nil;
                
                userMediaItemCollection=[MPMediaItemCollection collectionWithItems:[mediaItemCollection    items]];
                
                [musicPlayer setQueueWithItemCollection:userMediaItemCollection];
                [musicPlayer setNowPlayingItem:    
                [[userMediaItemCollectionitems]objectAtIndex:indexOfCurrentObject]];
                [self enablePrevAndNextButtons];
                
                [musicPlayer play];        
                }
                
                -(void)playbackStateDidChanged:(NSNotification *)notification
                {
                
                 if (musicPlayer.playbackState!=MPMusicPlaybackStatePlaying)
                 {
                    [playPauseButton setBackgroundImage:[UIImage imageNamed:@"play_iPad.png"] forState:UIControlStateNormal];
                 }
                 else if(musicPlayer.playbackState==MPMusicPlaybackStatePlaying)
                 {
                    [playPauseButton setBackgroundImage:[UIImage imageNamed:@"pause_iPad.png"] forState:UIControlStateNormal];
                 }
                

                推荐答案

                我也向 Apple 报告了这个错误.通过执行以下操作,我能够 100% 地重现它:

                I have also reported this bug to Apple. I was able to reproduce it 100% of the time by doing the following:

                启动使用 MPMusicPlayerController 的应用程序.启动音乐"应用程序.点击播放,跳过,跳过,暂停,播放,暂停打开原应用,MPMusicPlayerController的MPMusicPlaybackState会出错.

                Launch application that uses MPMusicPlayerController. Launch the "Music" App. Hit Play, Skip, Skip, Pause, Play, Pause Open the original application and the MPMusicPlaybackState of MPMusicPlayerController will be incorrect.

                这里提出的解决方案都不适合我.有效的解决方案是跟踪错误发生的时间并在这些情况下特别更新 UI.

                None of the proposed solutions here worked for me. The solution that did work was to keep track of when the bug was occurring and updating the UI specially in these cases.

                当收到 UIApplicationDidBecomeActiveNotification 通知时(有关这方面的更多详细信息,请参阅 matbur 帖子),查看当 MPMusicPlaybackState 说它是时音频是否实际上没有播放:

                When the UIApplicationDidBecomeActiveNotification notification is received (see matbur post for more details on this), see if audio is actually not playing when the MPMusicPlaybackState said it was:

                -(BOOL) isPlaybackStateBugActive {
                    MPMusicPlaybackState playbackState = self.musicPlayer.playbackState;
                    if (playbackState == MPMusicPlaybackStatePlaying) {
                        AudioSessionInitialize (NULL, NULL, NULL, NULL);
                        UInt32 sessionCategory = kAudioSessionCategory_AmbientSound;
                        AudioSessionSetProperty (kAudioSessionProperty_AudioCategory, sizeof (sessionCategory), &sessionCategory);
                        AudioSessionSetActive (true);
                
                        UInt32 audioIsPlaying;
                        UInt32 size = sizeof(audioIsPlaying);
                        AudioSessionGetProperty(kAudioSessionProperty_OtherAudioIsPlaying, &size, &audioIsPlaying);
                
                        if (!audioIsPlaying){
                            NSLog(@"PlaybackState bug is active");
                            return YES;
                        }
                    }
                
                    return NO;
                }
                

                别忘了导入 AudioToolbox 框架.

                Don't forget to import the AudioToolbox framework.

                这篇关于在 ios 5 中的 MP 音乐播放器控制器中出现错误的播放状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:使用 UITableView 和 NSOrderedSet 对核心数据进行排序 下一篇:iPhone iOS5 CLGeocoder 如何对大量(200)组地址进行地理

                相关文章

                最新文章

                  <bdo id='M1Yf6'></bdo><ul id='M1Yf6'></ul>

                1. <small id='M1Yf6'></small><noframes id='M1Yf6'>

                  1. <tfoot id='M1Yf6'></tfoot>

                    <i id='M1Yf6'><tr id='M1Yf6'><dt id='M1Yf6'><q id='M1Yf6'><span id='M1Yf6'><b id='M1Yf6'><form id='M1Yf6'><ins id='M1Yf6'></ins><ul id='M1Yf6'></ul><sub id='M1Yf6'></sub></form><legend id='M1Yf6'></legend><bdo id='M1Yf6'><pre id='M1Yf6'><center id='M1Yf6'></center></pre></bdo></b><th id='M1Yf6'></th></span></q></dt></tr></i><div id='M1Yf6'><tfoot id='M1Yf6'></tfoot><dl id='M1Yf6'><fieldset id='M1Yf6'></fieldset></dl></div>
                    <legend id='M1Yf6'><style id='M1Yf6'><dir id='M1Yf6'><q id='M1Yf6'></q></dir></style></legend>