我曾尝试使用vlckit for mac os x播放视频, 使用下面的代码,但是,编译后我看不到视频,但黑屏,但没有视频播放。
这里a.mp4是我的主要捆绑包中的视频,我曾断言视频路径正确。 让我知道为什么我无法在屏幕上观看视频是什么问题。
// Set up a videoView by hand. You can also do that in the nib file
videoView = [[VLCVideoView alloc] initWithFrame:NSMakeRect(0, 0, 400, 400)];
[self.view addSubview:videoView];
[videoView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
// Init the player object
player = [[VLCMediaPlayer alloc] initWithVideoView:videoView];
[player setMedia:[VLCMedia mediaWithPath:@"/Users/gurpalrajput/Desktop/demoVlc Player/demoVlc Player/a.mp4"]];
[player play];
答案 0 :(得分:0)
那条路看起来不对;对于 macOS 应用程序内部的资源,我期望像/path/to/Application.app/Contents/Resources/a.mp4
这样的东西。您不再使用iOS ...;)
通常,您希望以编程方式解析应用程序捆绑包内资源的路径;电影将是:
NSString* path = [NSBundle.mainBundle pathForResource:@"a" ofType:@"mp4"];