我希望视频文件在我的应用程序中重复播放,并且我正在使用 MPMoviePlayerController 来播放视频文件

发布于 2024-10-21 23:37:22 字数 487 浏览 2 评论 0原文

嗨朋友们, 我希望视频文件在我的应用程序中重复播放,并且我使用以下代码来播放视频文件

NSString *tempurl = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Movie.m4v"];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:tempurl]];
player.view.frame = CGRectMake(0, 0, 867, 1008);
player.scalingMode = MPMovieScalingModeFill;
[self.view addSubview:player.view];
[player play];

我可以使用可以在视频文件播放结束时发出警报的委托方法吗 先感谢您

HI Friends,
I Want the Video File To Play repeatedly in my application and i have used the Following code to play the video file

NSString *tempurl = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Movie.m4v"];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:tempurl]];
player.view.frame = CGRectMake(0, 0, 867, 1008);
player.scalingMode = MPMovieScalingModeFill;
[self.view addSubview:player.view];
[player play];

Can I Have The Delegate method that can give the alert for the video file end playing
Thank You In Advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

末が日狂欢 2024-10-28 23:37:22

您可以使用属性“repeatMode”并将其设置为 MPMovieRepeatModeOne

//Determines how the movie player repeats the playback of the movie.


@property(nonatomic) MPMovieRepeatMode repeatMode

//Discussion The default value of this property is MPMovieRepeatModeNone. 

   // For a list of available repeat modes, see “MPMovieRepeatMode.”

// Availability Available in iOS 3.2 and later.Declared In MPMoviePlayerController.h

NSString *tempurl = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Movie.m4v"];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:tempurl]];

player.view.frame = CGRectMake(0, 0, 867, 1008);

player.scalingMode = MPMovieScalingModeFill;

player.repeatMode = MPMovieRepeatModeOne;

[self.view addSubview:player.view];

[player play];

you can use the property "repeatMode" and set it to MPMovieRepeatModeOne

//Determines how the movie player repeats the playback of the movie.


@property(nonatomic) MPMovieRepeatMode repeatMode

//Discussion The default value of this property is MPMovieRepeatModeNone. 

   // For a list of available repeat modes, see “MPMovieRepeatMode.”

// Availability Available in iOS 3.2 and later.Declared In MPMoviePlayerController.h

NSString *tempurl = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Movie.m4v"];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:tempurl]];

player.view.frame = CGRectMake(0, 0, 867, 1008);

player.scalingMode = MPMovieScalingModeFill;

player.repeatMode = MPMovieRepeatModeOne;

[self.view addSubview:player.view];

[player play];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文