Merge pull request #26 from volgin/master
Enable playing local files in iOS.
This commit is contained in:
commit
ad88e986f3
|
@ -155,7 +155,16 @@
|
|||
[[NSNotificationCenter defaultCenter] removeObserver:_endObserver];
|
||||
_endObserver = 0;
|
||||
}
|
||||
AVPlayerItem* playerItem = [[AVPlayerItem alloc] initWithURL:[NSURL URLWithString:url]];
|
||||
|
||||
AVPlayerItem *playerItem;
|
||||
|
||||
//Allow iOs playing both external links and local files.
|
||||
if ([url hasPrefix:@"file://"]) {
|
||||
playerItem = [[AVPlayerItem alloc] initWithURL:[NSURL fileURLWithPath:[url substringFromIndex:7]]];
|
||||
} else {
|
||||
playerItem = [[AVPlayerItem alloc] initWithURL:[NSURL URLWithString:url]];
|
||||
}
|
||||
|
||||
[playerItem addObserver:self
|
||||
forKeyPath:@"status"
|
||||
options:NSKeyValueObservingOptionNew
|
||||
|
|
Loading…
Reference in New Issue