Open Qiyun2014 opened 7 years ago
[NSURL fileURLWithPath:@"udp://10.5.5.9:8554"]
(id)initWithFrame:(CGRect)frame contentUrl:(NSURL *)url{
if (self == [super initWithFrame:frame]) {
self.url = url; // 日志相关
[IJKFFMoviePlayerController setLogReport:YES]; [IJKFFMoviePlayerController setLogLevel:k_IJK_LOG_DEBUG];
[IJKFFMoviePlayerController setLogReport:NO]; [IJKFFMoviePlayerController setLogLevel:k_IJK_LOG_INFO];
// 版本检测 [IJKFFMoviePlayerController checkIfFFmpegVersionMatch:YES]; [IJKFFMoviePlayerController checkIfPlayerVersionMatch:YES major:1 minor:0 micro:0]; // 播放器创建 self.player = [[IJKFFMoviePlayerController alloc] initWithContentURL:self.url withOptions:[self optionsByDefault]]; // 播放视图参数 self.player.view.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; self.player.view.frame = self.bounds; // 播放页面显示模式 self.player.scalingMode = IJKMPMovieScalingModeAspectFit; self.autoresizesSubviews = YES; [self addSubview:self.player.view]; // 准备播放 self.player.shouldAutoplay = YES; [self.player prepareToPlay]; [self installMovieNotificationObservers];
} return self; }
(IJKFFOptions )optionsByDefault { IJKFFOptions options = [[IJKFFOptions alloc] init]; [options setPlayerOptionIntValue:30 forKey:@"max-fps"]; // 最大fps [options setPlayerOptionIntValue:0 forKey:@"framedrop"]; // 跳帧开关 [options setPlayerOptionIntValue:3 forKey:@"video-pictq-size"]; // [options setPlayerOptionIntValue:0 forKey:@"videotoolbox"]; // videotoolbox开关 [options setPlayerOptionIntValue:320 forKey:@"videotoolbox-max-frame-width"]; // 指定最大宽度
[options setFormatOptionIntValue:0 forKey:@"auto_convert"]; // 自动转屏开关 [options setFormatOptionIntValue:1 forKey:@"reconnect"]; // 重连次数 [options setFormatOptionIntValue:0/30 1000 1000/ forKey:@"timeout"]; // 超时时间
[options setFormatOptionIntValue:8192 forKey:@"probsize"]; [options setFormatOptionIntValue:200000 forKey:@"analyzeduration"]; [options setFormatOptionValue:@"nobuffer" forKey:@"fflags"];
[options setFormatOptionValue:@"ijkplayer" forKey:@"user-agent"]; // ua options.showHudView = NO; return options; }
你好!你这个问题解决了没有?
额,我解决了,自己用ffmpeg做了个播放器;
能给我demo吗?
[NSURL fileURLWithPath:@"udp://10.5.5.9:8554"]
(id)initWithFrame:(CGRect)frame contentUrl:(NSURL *)url{
if (self == [super initWithFrame:frame]) {
ifdef DEBUG
else
endif
} return self; }
(IJKFFOptions )optionsByDefault { IJKFFOptions options = [[IJKFFOptions alloc] init]; [options setPlayerOptionIntValue:30 forKey:@"max-fps"]; // 最大fps [options setPlayerOptionIntValue:0 forKey:@"framedrop"]; // 跳帧开关 [options setPlayerOptionIntValue:3 forKey:@"video-pictq-size"]; // [options setPlayerOptionIntValue:0 forKey:@"videotoolbox"]; // videotoolbox开关 [options setPlayerOptionIntValue:320 forKey:@"videotoolbox-max-frame-width"]; // 指定最大宽度
[options setFormatOptionIntValue:0 forKey:@"auto_convert"]; // 自动转屏开关 [options setFormatOptionIntValue:1 forKey:@"reconnect"]; // 重连次数 [options setFormatOptionIntValue:0/30 1000 1000/ forKey:@"timeout"]; // 超时时间
[options setFormatOptionIntValue:8192 forKey:@"probsize"]; [options setFormatOptionIntValue:200000 forKey:@"analyzeduration"]; [options setFormatOptionValue:@"nobuffer" forKey:@"fflags"];
[options setFormatOptionValue:@"ijkplayer" forKey:@"user-agent"]; // ua options.showHudView = NO; return options; }