【问题标题】:Problems with currentPlaybackTime and MPMusicPlayerController and iOS 7.1currentPlaybackTime 和 MPMusicPlayerController 以及 iOS 7.1 的问题
【发布时间】:2014-04-27 17:30:46
【问题描述】:

在 iOS 7.1 中使用 MPMusicPlayerController 设置 currentPlaybackTime 时出现问题。 我曾经能够简单地执行以下操作:

MPMusicPlayerController *iPodController =
[MPMusicPlayerController applicationMusicPlayer]; 
iPodController.currentPlaybackTime = 30.0;
[iPodController play];

音乐播放器会在 30 秒内播放。

从 iOS 7.1 开始,情况并非如此。

如果我执行以下操作:

[iPodController play];
iPodController.currentPlaybackTime = 30.0;

然后它“可能”跳进或不跳进 30 秒。很不协调。

这曾经适用于所有以前的 iOS 版本。有没有办法解决这个问题?

【问题讨论】:

  • 推测:如果需要在设置 currentPlayBackTime 之前播放歌曲,则连续调用 play 和 setCurrentPlayBackTime 可能会很快发生。播放器可能没有将其状态更改为正在播放。
  • 已删除的答案建议改为设置initialPlaybackTime

标签: ios iphone audio ios7.1 mpmusicplayercontroller


【解决方案1】:

我发现在播放给定歌曲之前我无法设置currentPlaybackTime

使用你的第一个 sn-p:

iPodController.currentPlaybackTime = 30.0;
[iPodController play];

设置currentPlaybackTime 属性没有任何作用,我无法找到所需的播放时间。但到目前为止,我在 iOS 7.1 上使用相反的方式进行调用一直有效:

[iPodController play];
iPodController.currentPlaybackTime = 30.0;

【讨论】:

  • Niels,对于某些人来说,调用播放函数然后设置currentPlaybackTime会导致播放器开始播放,然后一秒左右跳到30。我认为没有解决方案,因为似乎 currentPlayBackTime 不久前已被弃用。我有这个与 AVPlayer 一起工作,但如前所述,AVPlayer 不会播放受 FairPlay 保护的文件。非常令人沮丧。
猜你喜欢
  • 1970-01-01
  • 2012-06-08
  • 2016-09-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-12-23
  • 2014-07-08
  • 1970-01-01
相关资源
最近更新 更多