- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要获取有关使用 MPMoviePlayer 播放视频的总时间的信息。当用户观看 3 分钟的视频长达 2 分钟并向后移动到 1.30 并关闭视频时如何处理这种情况。要求是知道分数用户准确观看的视频。
最佳答案
来自 MPMoviePlayerController
上的 Apple 文档:
Movie Player Notifications
A movie player generates notifications to keep your app informed about the state of movie playback. In addition to being notified when playback finishes, your app can be notified in the following situations:
- When the movie player begins playing, is paused, or begins seeking forward or backward
使用这些通知,您可以设置自己的计时器以了解视频已播放的总时间。具体来说,您可能需要 MPMoviePlayerPlaybackStateDidChangeNotification
。
了解观看视频的总百分比可能有点棘手,但我认为仍有可能。您需要注册 MPMediaPlayback
协议(protocol)并将其与上面提到的 PlaybackStateDidChangeNotification
结合使用。
我有一个想法(虽然可能不是最好或最有效的方法)是创建一个 BOOL
值数组,视频的每一秒 1。播放视频时,获取播放器上的 currentPlaybackTime
并在播放时标记每一秒。如果视频状态发生变化(暂停、快进等),停止标记它们直到它恢复,然后根据新的 currentPlaybackTime
从新索引开始并继续标记。完成后,计算已标记索引的百分比。
MPMoviePlayerController
MPMediaPlayback Protocol
如果这对你有用,请告诉我!
关于ios - 在 MPMoviePlayer 中获取视频的总播放时长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23427263/
我想使用以下代码隐藏 MPMoviePlayer 中的控件: -(IBAction)video:(id)sender { NSBundle *bundle = [NSBundle mainBundle
我正在使用 MPMoviePlayer 来播放电影。我希望能够播放电影并允许用户通过按按钮跳到电影中的特定时间。 我正在设置播放器的 currentPlaybackTime 属性,但它似乎不起作用。相
我正在使用 MP Movie Player 播放实时 channel 提要,我还在 View 上添加了点击手势,用于隐藏和取消隐藏 Collection View ,然后将此 View 添加到播放器
我希望在用谷歌搜索这些词的所有可能组合时能找到这个解决方案。 您是否像我一样认为可以下载 Apple 的 Movieplayer 示例,单击“构建并运行”并观看飞机电影?什么也没发生,对吧? 解决方法
在我的应用程序中,我有一个 UIWebview,其中显示了一个视频链接列表。单击这些链接之一,MPMoviePlayer 将自行启动。但在全屏模式下,它不会在需要时旋转。 现在如何旋转它,因为我无法在
需要使用 MpMoviePlayerController 在后台播放音频。我知道我必须使用这段代码来实现: AVAudioSession *audioSession = [AVAudioSessi
我正在使用 iPhone 中的视频应用程序。当用户点击一个按钮时,它会导致第二个 View ,然后我从那里播放来自 url 的视频。 但是当用户从该 View 返回并再次转到该 View 时,视频未播
我正在我的应用程序中的 MPMoviePlayer 中播放视频,我正在从服务器获取视频。如果视频长度大约为 25 秒或更长,音频就会中断。意味着当播放视频时,当它播放到一半时就听不到音频。但是如果我寻
我正在使用 MPMoviePlayerController 播放视频流。因为原始数据中嵌入了一些我需要解析的元数据,所以我需要找到一种方法来访问原始视频数据。有谁知道这样做的方法吗?嵌入的元数据没有
我遇到了这个奇怪的问题。当我使用 MpMoviePlayerController 播放任何视频时,如果我收到任何提醒警报 并且我选择了关闭,那么我的应用程序将崩溃并显示日志: "An AVPlayer
有没有办法检测在 MPMoviePlayerController 中播放视频时缓冲了多少数据? 我已经检查了 loadState,但这并没有给我足够的缓冲信息。 Youtube 的应用正是我想要的..
MPMoviePlayer 没有播放视频。我正在运行 iOS 7 并在设备和模拟器上遇到相同的错误: 2013-10-02 12:49:18.246 xxxx[688:60b] _itemFailed
我正在尝试在某个点搜索视频文件。假设视频长 5 分钟,我在 110 秒处跳入。 当我从头开始播放时,一切正常,但是,当我尝试搜索文件时,我可以听到音频但看不到视频。我首先认为这可能是我加载 subvi
我正在尝试使用 MPMoviePlayer 播放简单的电影,但控制台中一直出现此错误(但电影已播放):我的 xcode 版本是 4.3.1。 2012-03-24 14:51:49.488 europ
我正在编写一个应用程序,将照片卷中的电影存储到该应用程序的本地文档文件夹中。我可以使用 MPMoviePlayer 播放远程电影,但是尝试播放存储在应用程序文档文件夹中的电影总是返回 MPMovieL
我正在使用 MPMoviePlayer 来显示视频。我进入全屏模式,当单击完成按钮时,我希望它从我的 View 中删除整个电影播放器。目前它只退出全屏模式。您如何跟踪被点击的 doneButton
如果电影结束时出现错误,那么我可能会收到如下错误: Error Domain=MediaPlayerErrorDomain Code=-12847 "This movie format is not
在全新安装 Xcode 3.1.2 时,我尝试使用 iPhone MoviePlayer,如 http://developer.apple.com/iphone/library/codinghowto
我正在使用 iOS5。 我正在开发 HTTPLivestream 项目。这里我使用 MPMovieplayer ,我的问题是当应用程序转到后台时没有音频。我正在后台模式下更改 plist 为音频。但是
我有一部很长的电影,我将把它放入应用程序中,我想知道让用户回到他们上次停下的地方的最佳方法是什么。有人能指出我正确的方向吗? 因此,如果用户正在观看电影,点击“完成”,是否有当前时间的通知或我可以在该
我是一名优秀的程序员,十分优秀!