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

    1. <small id='3qUKe'></small><noframes id='3qUKe'>

      • <bdo id='3qUKe'></bdo><ul id='3qUKe'></ul>

    2. 如何恢复正在使用 presentMoviePlayerViewControllerAnim

      时间:2023-05-30

    3. <tfoot id='l8zoO'></tfoot>

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

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

              <tbody id='l8zoO'></tbody>
              <bdo id='l8zoO'></bdo><ul id='l8zoO'></ul>
              • <legend id='l8zoO'><style id='l8zoO'><dir id='l8zoO'><q id='l8zoO'></q></dir></style></legend>
              • 本文介绍了如何恢复正在使用 presentMoviePlayerViewControllerAnimated 播放的电影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我正在使用此代码来显示电影:

                I'm uisng this code to display a movie:

                 MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc]
                 initWithContentURL:movieURL];
                 mp.moviePlayer.movieSourceType = MPMovieSourceTypeUnknown;
                 [self presentMoviePlayerViewControllerAnimated:mp]; [mp.moviePlayer play];
                

                代码运行良好.但是,当应用程序在播放电影时进入后台时,当应用程序返回前台时,不会显示电影播放器​​.(我看到了调用 presentMoviePlayerViewControllerAnimated:mp

                The code is working fine. However when the application goes to the background while playing a movie, when the app comes back in the foreground the movieplayer is not displayed. (I see the view of the controller that called presentMoviePlayerViewControllerAnimated:mp

                是否可以在进入前台时恢复应用进入后台之前正在播放的电影?

                Is it possible when entering the foregound to resume the movie that was playing before the app went to the background?

                推荐答案

                你可以实现通知技术来处理它.在正在播放电影播放器​​的类中添加一个通知,并将其关联一个选择器.当应用程序进入后台时,然后在委托方法中

                you can implement notification techniques to handle it. Add a notification in the class where movie player is playing and associate with it a selector. When app goes to background then in the delegate method

                - (void)applicationDidEnterBackground:(UIApplication *)application
                
                {
                
                // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
                
                 // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
                
                
                    UIApplication *app = [UIApplication sharedApplication];
                    UIBackgroundTaskIdentifier bgTask = 0;
                
                    bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
                        [app endBackgroundTask:bgTask];
                    }];
                
                }
                

                编写此代码.实际上,当应用程序进入后台时,它会暂停 MPMoviePlayerController,因此当它进入前台时,您会发布通知,该通知调用实现电影控制器的类中的方法并在此方法中再次播放.

                write this code.Actually when app goes background it pauses the MPMoviePlayerController so when it is coming to foreground you post the notification which call the method in class where movie controller is implemented and play it again in this method.

                -(void)playIntroAnimationAgain
                
                {
                
                [[NSNotificationCenter defaultCenter]removeObserver:self name:NOTIFICATION_PlayAgain_Player object:nil];
                
                        [self.moviePlayerController play];
                
                       [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playIntroAnimationAgain)name:NOTIFICATION_PlayAgain_Player object:nil];
                }
                

                它解决了我的问题.

                这篇关于如何恢复正在使用 presentMoviePlayerViewControllerAnimated 播放的电影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:应用程序 '' 异常退出,信号 11:分段错误 下一篇:未找到 ios 类“预期类型"

                相关文章

                最新文章

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

                  <legend id='ud4QO'><style id='ud4QO'><dir id='ud4QO'><q id='ud4QO'></q></dir></style></legend>

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

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