11

ストリームを5秒巻き戻すにはどうすればよいですか?

これは、viewDidLoadでストリーミングするための私のコードです。

AVPlayerItem* playerItem = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:@"http://groove.wavestreamer.com:7321/listen.pls?sid=1"]];

[playerItem addObserver:self forKeyPath:@"timedMetadata" options:NSKeyValueObservingOptionNew context:nil];

music = [[AVPlayer playerWithPlayerItem:playerItem] retain];
[music play]; 

music = [[AVPlayer playerWithPlayerItem:playerItem] retain];
[music play];

あなたの答えをありがとう...

4

3 に答える 3

11
- (NSTimeInterval)currentPlaybackTime
{
    return CMTimeGetSeconds(self.playerView.player.currentItem.currentTime);
}


- (void)setCurrentPlaybackTime:(NSTimeInterval)time
{
    CMTime cmTime = CMTimeMakeWithSeconds(time, NSEC_PER_SEC);
    [self.playerView.player.currentItem seekToTime:cmTime];
}


- (IBAction)scanBackward
{
    self.currentPlaybackTime -= 5.0f;
}
于 2013-03-24T18:29:29.070 に答える