MPMoviePlayer playing audio but not video when seeking into a file
I'm trying to seek into a video file at a certain point. Lets say the
video is 5 minutes long and I'm jumping in at 110 seconds.
When I play from the beginning, everything plays through fine, however,
when I try to seek into the file, I can hear the audio but I can't see the
video. I first thought this was maybe an issue with the order I'm loading
the subviews but I can still see (and use) the controls for the player.
Sliding back to 0:00 starts the video.
The following is code from my video class. The initIntoView method accepts
a UIView and then returns an amended copy which then gets written to the
main view. Sorry in advance for the messy code. I'm still quite new to
Objective-C.
Init the Video view
- (WWFVideo*) initIntoView: (UIView*) view
withContent:(NSDictionary*)contentDict{
self=[super init];
viewRef=view;
contentData = contentDict;
NSURL *videoUrl = [[NSURL alloc]initWithString:[contentDict
objectForKey:@"cnloc"]]; //Returns a HTTP link to my video file (MP4,
H.246, AAC Audio)
videoController = [[MPMoviePlayerController alloc] init];
videoController.movieSourceType = MPMovieSourceTypeFile;
[videoController setContentURL:videoUrl];
videoController.view.frame = viewRef.bounds;
[videoController.view
setAutoresizingMask:UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleHeight];
[viewRef addSubview:videoController.view];
return self;
}
Start playing the video
-(void)play:(int)offset { //Offset is "110"
[videoController setInitialPlaybackTime:offset];
[videoController play];
}
I've tried adding the videoController to viewRef both before and after the
video starts playing but it has the same outcome.
I've also tried using an MPMoviePlayerViewController with no avail.
If I've missed any more vital code, just ask and I'll see what I can do.
Edit:
Xcode 4.6.3
iOS 6
Testing on an iPad 2
No comments:
Post a Comment