• <tfoot id='pjsse'></tfoot>

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

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

        <bdo id='pjsse'></bdo><ul id='pjsse'></ul>
      1. <legend id='pjsse'><style id='pjsse'><dir id='pjsse'><q id='pjsse'></q></dir></style></legend>

        基于 iOS4 和部署 iOS3 的媒体播放器出现问题

        时间:2023-10-23
          <i id='Fyl01'><tr id='Fyl01'><dt id='Fyl01'><q id='Fyl01'><span id='Fyl01'><b id='Fyl01'><form id='Fyl01'><ins id='Fyl01'></ins><ul id='Fyl01'></ul><sub id='Fyl01'></sub></form><legend id='Fyl01'></legend><bdo id='Fyl01'><pre id='Fyl01'><center id='Fyl01'></center></pre></bdo></b><th id='Fyl01'></th></span></q></dt></tr></i><div id='Fyl01'><tfoot id='Fyl01'></tfoot><dl id='Fyl01'><fieldset id='Fyl01'></fieldset></dl></div>
              <tbody id='Fyl01'></tbody>
              <tfoot id='Fyl01'></tfoot>

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

                <legend id='Fyl01'><style id='Fyl01'><dir id='Fyl01'><q id='Fyl01'></q></dir></style></legend>
                  <bdo id='Fyl01'></bdo><ul id='Fyl01'></ul>
                  本文介绍了基于 iOS4 和部署 iOS3 的媒体播放器出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在设备 3.1.2 上运行时,为什么它也会通过 if(NSClassFromString(@"MPMoviePlayerViewController") != nil)并且做iOS4的代码然后它会崩溃,如何解决这个问题?

                  when Run on Device 3.1.2, why it also pass if(NSClassFromString(@"MPMoviePlayerViewController") != nil) and do code of iOS4 then it will crash , how to fix this issues?

                                 if(NSClassFromString(@"MPMoviePlayerViewController") != nil) {
                                      // iOS 4 code
                                      NSLog(@"MPMoviePlayerViewController");
                                      MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:AppDelegate.PushLink]];
                                      if (mp) {
                                          // save the movie player object
                                          self.theMovie4 = mp;
                                          [mp release];
                                          //Present                       
                                          [self presentMoviePlayerViewControllerAnimated:self.theMovie4];
                  
                                          // Play the movie!
                                          self.theMovie4.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
                                          [self.theMovie4.moviePlayer play];
                                      }
                                  }
                                  else {
                                      //iOS 3 Code
                                      AppDelegate = nil;
                                      AppDelegate = [[UIApplication sharedApplication] delegate];
                                      [AppDelegate ForceHideNavigationBar];
                                      theMovie3 = nil;
                  
                                      [[NSNotificationCenter defaultCenter] addObserver:self 
                                                                               selector:@selector(moviePreloadDidFinish:) 
                                                                                   name:MPMoviePlayerContentPreloadDidFinishNotification 
                                                                                 object:theMovie3];
                  
                                      [[NSNotificationCenter defaultCenter] addObserver:self 
                                                                               selector:@selector(moviePlayBackDidFinish:) 
                                                                                   name:MPMoviePlayerPlaybackDidFinishNotification 
                                                                                 object:theMovie3];
                  
                                      // Register to receive a notification when the movie scaling mode has changed. 
                                      [[NSNotificationCenter defaultCenter] addObserver:self 
                                                                               selector:@selector(movieScalingModeDidChange:) 
                                                                                   name:MPMoviePlayerScalingModeDidChangeNotification 
                                                                                 object:theMovie3];
                  
                                      theMovie3 = [[MPMoviePlayerController alloc] initWithContentURL: [NSURL URLWithString:AppDelegate.PushLink]];
                  
                                      [theMovie3 play];
                  
                                  }
                  

                  推荐答案

                  我在使用 4.0 作为基础 SDK 的应用程序上做了一个非常相似的事情,但我也针对 iOS3 设备.我必须检查操作系统版本才能正确地为视频播放提供正确的代码.例如:

                  I am doing a very similar thing on my app which is using 4.0 as the base SDK and yet I am targeting iOS3 devices too. I had to check the OS version to properly provide the right code for the video playback. For example:

                  - (void) playMovieAtURL: (NSURL*) theURL {
                      NSLog(@"playMovieAtURL");
                  
                  if ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 3.2) {
                              NSLog(@"> 3.2");
                              MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:theURL];
                  
                              if (mp)
                              {
                                  // save the movie player object
                                  //self.moviePlayerViewController = mp;
                                  //[mp release];
                                  [self presentMoviePlayerViewControllerAnimated:mp];
                                  mp.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
                                  [mp.moviePlayer play];
                                  [mp release];
                              }
                  
                          } 
                      else if ([[[UIDevice currentDevice] systemVersion] doubleValue] < 3.2) {
                              NSLog(@"< 3.2");
                  
                              MPMoviePlayerController* theMovie = [[MPMoviePlayerController alloc] initWithContentURL: theURL];
                  
                              theMovie.scalingMode = MPMovieScalingModeAspectFill;
                  
                              // Register for the playback finished notification
                              [[NSNotificationCenter defaultCenter]
                               addObserver: self
                               selector: @selector(myMovieFinishedCallback:)
                               name: MPMoviePlayerPlaybackDidFinishNotification
                               object: theMovie];
                  
                              // Movie playback is asynchronous, so this method returns immediately.
                              [theMovie play];
                  
                  
                  
                          }
                  
                      }
                  

                  希望这会有所帮助!

                  这篇关于基于 iOS4 和部署 iOS3 的媒体播放器出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:从 ABAddressBook 获取合并/统一的条目 下一篇:如何在 UItextView 中添加 placeHolder 文本?在 iphone sdk 中

                  相关文章

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

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

                        <bdo id='ggvnH'></bdo><ul id='ggvnH'></ul>
                    1. <tfoot id='ggvnH'></tfoot>
                    2. <small id='ggvnH'></small><noframes id='ggvnH'>