播放 QuickTime 电影时如何触发章节标记事件?

发布于 2024-11-03 02:56:30 字数 230 浏览 2 评论 0原文

我正在尝试创建一个 iPad 应用程序,我需要在其中播放包含一些章节标记的 Quicktime 电影。当到达每个标记时,我需要在视频顶部显示一个小的覆盖层。 有没有办法在每次到达标记时触发事件/函数?如果是这样,怎么办?

我对从头开始开发具有编解码器处理功能的整个电影播放器​​不感兴趣,因为这超出了我的舒适区 - 所以我希望使用 MPMoviePlayer 或类似的东西可以做到这一点。

非常感谢任何帮助! :)

I'm trying to create an iPad app where i need to playback a quicktime movie which contains some chapter markers. When each marker is reached i need a small overlay to be shown on top of the video.
Is there a way to trigger an event/function each time a marker is reached? And if so, how?

I'm not interested in having to develop an entire movieplayer with codec handling from scratch, since this is out of my comfortzone - So I'm hoping this is possible using MPMoviePlayer or something similar.

Any help is greatly appreciated! :)

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

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

发布评论

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

评论(1

淡淡離愁欲言轉身 2024-11-10 02:56:30

注册以接收以下通知:

#define MPAVControllerTimeDidJumpNotification @"MPAVControllerTimeDidJumpNotification"

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleTimeChanged:) name:MPAVControllerTimeDidJumpNotification object:nil];

-(void)handleTimeChanged:(NSNotification *)notification
{
    static int i = 0;
    NSDictionary * userInfo = notification.userInfo;
    int lastPositionInSeconds = [[userInfo valueForKey:@"MPAVControllerTimeParameter"] intValue];
    if(lastPositionInSeconds > markers[i])
    {
         i++;
         [self showOverlay: i];
    }
}

还要注册以接收 MPMoviePlayerPlaybackDidFinishNotification 通知以停止侦听 MPAVControllerTimeDidJumpNotification 通知。

Register to receive the following notification:

#define MPAVControllerTimeDidJumpNotification @"MPAVControllerTimeDidJumpNotification"

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleTimeChanged:) name:MPAVControllerTimeDidJumpNotification object:nil];

-(void)handleTimeChanged:(NSNotification *)notification
{
    static int i = 0;
    NSDictionary * userInfo = notification.userInfo;
    int lastPositionInSeconds = [[userInfo valueForKey:@"MPAVControllerTimeParameter"] intValue];
    if(lastPositionInSeconds > markers[i])
    {
         i++;
         [self showOverlay: i];
    }
}

Also register to receive MPMoviePlayerPlaybackDidFinishNotification notification to stop listening for the MPAVControllerTimeDidJumpNotification notification.

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