gpt4 book ai didi

iphone - MPMoviePlayerController 不工作,也没有通知

转载 作者:行者123 更新时间:2023-12-03 21:16:54 25 4
gpt4 key购买 nike

有人可以指出为什么这不起作用吗?

NSURL  *url = [NSURL fileURLWithPath:ImageName];

MPMoviePlayerController *video = [[MPMoviePlayerController alloc] initWithContentURL:url];
NSLog(@"%@", ImageName);
NSLog(@" %@", url);
[canvas addSubview:video.view];
video.view.frame = canvas.bounds;

// [video setControlStyle:MPMovieControlStyleEmbedded];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:video];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieCallback:) name:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey object:video];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieCallback:) name:MPMoviePlayerPlaybackStateDidChangeNotification object:video];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieCallback:) name:MPMoviePlayerLoadStateDidChangeNotification object:video];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieCallback:) name:MPMoviePlayerNowPlayingMovieDidChangeNotification object:video];
[video prepareToPlay];

没有回调被触发。只要在 Canvas 所在的地方有一个空白区域即可。

最佳答案

MPMoviePlayerController 引用保留在实例变量或属性中对我有用。

关于iphone - MPMoviePlayerController 不工作,也没有通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11125655/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com