우리는 사용자가 비디오 및 이미지를 서버에 업로드 할 수있는 앱을 가지고 있습니다. 안드로이드에서 mp4 비디오를 업로드하면 ios 장치에서 재생되지 않습니다. 이것은 내 코드입니다. 플레이어 상태가 readytoplay로 표시되지만로드되지 않고 오류가 발생하지 않습니다. vieo는 웹과 안드로이드로 잘 돌아가고 있습니다. 이 같은안드로이드에서 업로드 된 mp4 비디오는 ios에서 재생되지 않습니다.
헤더 파일 :이 같은
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIView *playerView;
@end
실행 파일 : https://justgolive.net/assets/uploads/newrecordings/20919/19777983355a28e15326df6.mp4
NSURL *streamURL = [NSURL URLWithString:_videoUrl];
player = [AVPlayer playerWithURL:streamURL];
AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:player];
playerLayer.frame =self.previewView.frame;
playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
//CGRectMake(0, 50, self.view.frame.size.width, self.view.frame.size.height/1.2);
[self.previewView.layer addSublayer:playerLayer];
// [self.playerContainer setUserInteractionEnabled:NO]; //to avoid touch events when activity is on
[self.player addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew context:NULL];
player.actionAtItemEnd = AVPlayerActionAtItemEndNone;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playerItemDidReachEnd:)
name:AVPlayerItemDidPlayToEndTimeNotification
object:[player currentItem]];
플레이어의 play 메소드를 호출 했습니까? –
예, [player play]를 추가했습니다. – Logic