guilhermearaujo / GUIPlayerView

MIT License
163 stars 39 forks source link

Using mainBundle #2

Closed jimatwood closed 9 years ago

jimatwood commented 9 years ago

Is it possible to use something like NSString *thePath = [NSBundle mainBundle] pathForResource @"BigBuckBunny.mp3" ofType:@"mp4"]; in the GUIPlayerView instead of a remote URL? I'm trying to write this into an app that doesn't use the internet. Thank you!

I've made changes to the ViewController.m file but I'm getting a couple of obvious errors in the GUIPlayerView.m file, for example the AVURLAsset section.

Thanks!

guilhermearaujo commented 9 years ago

Yes, you can play local videos. If your file is called "BigBuckBunny.mp4", use:

NSString *path = [[NSBundle mainBundle] pathForResource @"BigBuckBunny" ofType:@"mp4"];
NSURL *url = [NSURL urlWithString:path];
[player setVideoURL:url];
[player prepareAndPlayAutomatically:<#BOOL#>];
jimatwood commented 9 years ago

Thank you! Works fantastic. Much appreciated.