2017-02-01 8 views
0

IOSでの起動画面としてのビデオObjective C ヘルプは高く評価されています。IOSでの起動画面としてのビデオObjective C

+3

、で初期状態のサムネイルを作成します(ビデオ親指を追加)し、anothercontollerでそのloadvideo(ウルinitalコントローラとして設定し、ビデオコントローラ)をした後、起動画面に追加して、どこでも –

+0

Anbu.Karthik @に移動し、あなたの答えがあります私の要件に合致していない、以下のMr.Abduの説明は私の必要条件とうまく一致する。とにかく、あなたの素早い返答に感謝します。 –

答えて

1

Moorthy これを実現するには、AVPlayerとAVPlayerViewControllerのヘルプを使用できます。

このトリックを行うプロセスを詳しく説明します。

ステップ1 次のフレームワークをXcodeプロジェクトに追加し、Appdelegateにインポートします。

  1. @import AVFoundation;
  2. @import AVKit;
  3. @import UIKit;

ステップ2 あなたがこの場所に

- (void)videoDidFinish:(id)notification { 

AVPlayerItem *p = [notification object]; 
     //do something with player if you want 

//Remove Observer 
[[NSNotificationCenter defaultCenter] removeObserver:self];  

//your initial view can proceed from here 
[self ProccedToYourViewController]; 
} 
を取ることになるあなたのAppdelegate didFinishLaunchingWithOptionsメソッドに動画を完了した後

// grab a local URL to our video 
     NSURL *videoURL = [[NSBundle mainBundle]URLForResource:@"myvideo" withExtension:@"mov"]; 

     // create an AVPlayer 
     AVPlayer *player = [AVPlayer playerWithURL:videoURL]; 

     // create a player view controller 
     AVPlayerViewController *controller = [[AVPlayerViewController alloc]init]; 
     controller.player = player; 
     controller.showsPlaybackControls = false; 
     controller.view.frame = self.window.frame; 
     controller.modalPresentationStyle = UIModalPresentationFullScreen; 
     self.window.rootViewController = controller; 
     [player play]; 

// Adding Observer for your video file, 
     NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 
     [notificationCenter addObserver:self selector:@selector(videoDidFinish:) name:AVPlayerItemDidPlayToEndTimeNotification object:nil]; 

ステップ3

を以下のコードを追加します。

いくつかのヒント

あなたがスムーズにフェードインを追加して、ビデオの再生を停止して、アニメーションをフェードアウトすることができ、私は今あなたが行く準備ができている自分

//AvplayerViewController View(Video View). 
[self.controller.view setAlpha:1.0f]; 
     [UIView animateWithDuration:2.0f animations:^{ 
//AvplayerViewController View(Video View) setting to hide. 
      [self.controller.view setAlpha:0.0f]; 
//initialview(Your Initial View) that add as window root now 
      self.window.rootViewController = initialview; 
      [initialview.view setAlpha:1.0f]; 
      [self.window makeKeyAndVisible]; 
} completion:nil]; 

のためにした方法を紹介します。乾杯

シンプル
+0

あなたの素早い応答をありがとう.... –

+0

あなたは大歓迎です... :) – Abdu

関連する問題