SJVideoPlayer不播放视频显示黑屏

时间:2018-12-06 09:39:41

标签: ios objective-c dealloc video-player

我只是使用以下代码,但是它显示黑屏。

SJVideoPlayer *videoPlayer = [SJVideoPlayer player];
videoPlayer.view.frame = CGRectMake(0, 20, 200, 200 * 9/16.0);
[self.view addSubview:videoPlayer.view];
videoPlayer.URLAsset = [[SJVideoPlayerURLAsset alloc] initWithURL:[NSURL URLWithString:@"http://yxfile.idealsee.com/9f6f64aca98f90b91d260555d3b41b97_mp4.mp4"]];
[videoPlayer play];

在日志中显示以下输出:-

SJBaseVideoPlayer<0x111dc82d0>.SJVideoPlayerPlayStatus.Prepare
VideoPlayerDemo[1093:534379] CredStore - performQuery - Error copying matching creds. Error=-25300, query={
class = inet;
"m_Limit" = "m_LimitAll";
"r_Attributes" = 1;
sync = syna;
}

VideoPlayerDemo[1093:534344] 91 - -[SJVideoPlayer dealloc]
VideoPlayerDemo[1093:534344] 58 - -[SJAVMediaPlaybackController dealloc]
VideoPlayerDemo[1093:534344] 42 - -[SJAVMediaPlayAsset dealloc]

1 个答案:

答案 0 :(得分:0)

它已发布,您应该对此有强烈的参考。

@interface YourViewController : UIViewController
// strong reference
@property (nonatomic, strong) SJVideoPlayer *videoPlayer;
@end

@implementation YourViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _videoPlayer = [SJVideoPlayer player];
    _videoPlayer.view.frame = CGRectMake(0, 20, 200, 200 * 9/16.0);
    [self.view addSubview:_videoPlayer.view];
    _videoPlayer.URLAsset = [[SJVideoPlayerURLAsset alloc] initWithURL:[NSURL URLWithString:@"http://yxfile.idealsee.com/9f6f64aca98f90b91d260555d3b41b97_mp4.mp4"]];
    [_videoPlayer play];
}

@end