[bilibili/ijkplayer]iOS怎么在播放开始的时候设置指定的时间点,让播放器从这个时间点开始播放

2024-08-20 409 views
1

如题,也就是seek 我设置setCurrentPlaybackTime 是不好使的

回答

8

我想切换URL的时候同时切换到上次播放视频的位置,我的代码是这样的 我想知道这样做哪里不对 //移除上一个view [_player shutdown]; [_player.view removeFromSuperview]; if (_player != nil) { _player = nil; } //新建一个新的view [IJKMediaModule sharedModule].appIdleTimerDisabled = YES; [IJKFFMoviePlayerController checkIfFFmpegVersionMatch:YES]; IJKFFOptions * options = [IJKFFOptions optionsByDefault]; [options setFormatOptionValue:@"ijktcphook" forKey:@"http-tcp-hook"]; NSURL *theMovieURL = [NSURL fileURLWithPath:path]; self.player = [[IJKFFMoviePlayerController alloc] initWithContentURL:theMovieURL withOptions:options]; self.player.scalingMode = IJKMPMovieScalingModeAspectFit; self.player.shouldAutoplay = YES; [self.view addSubview:_player.view]; [self.player prepareToPlay];

//设置seek的时间 这个时间算是prepare之后的设置时间吗? [self.player setCurrentPlaybackTime:10.0];

3

IJKMPMediaPlaybackIsPreparedToPlayDidChangeNotification

5

thanks to your reply , I also noticed that notification,I can set current time under this change,once again thank you for your reply .

7

你好 这个问题解决了吗,JKFFMoviePlayerController里没setCurrentPlaybackTime这个方法

6

我也是用currentPlaybackTime,seek回来后会有问题,会往回跳秒

1

seek 后是从最近的关键帧开始播放

9

@raymond1012 如何能让播放器seek到当前帧而不是关键帧呢?多等一会儿也可以,谢谢啦

1

[options setPlayerOptionIntValue:1 forKey:@"enable-accurate-seek"];

1

我也是用currentPlaybackTime,seek回来后会有问题,会往回跳秒

解决了吗