如何使用ALAsset URL在MPMoviePlayerController上播放视频?

时间:2014-03-26 06:23:31

标签: ios mpmovieplayercontroller alassetslibrary alasset

如何使用ALAsset URL在MPMoviePlayerController上播放视频?

我尝试使用setContentURL:方法直接将ALAsset URL提供给MPMoviePlayer,但它不起作用。

if (!self.moviePlayer)
{
    self.moviePlayer = [[MPMoviePlayerController alloc] init];
}

[self.moviePlayer setContentURL:[NSURL fileURLWithPath:playPath]];
self.moviePlayer.allowsAirPlay=YES;
self.moviePlayer.controlStyle=MPMovieControlStyleDefault;

[ScrollView addSubview: [self.moviePlayer view]];

self.moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
[self.moviePlayer prepareToPlay];
[self.moviePlayer play];

1 个答案:

答案 0 :(得分:0)

@Mahesh你可以试试这个:

self.moviePlayer.moviePlayer.movieSourceType = MPMovieSourceTypeFile ;