Merge pull request #8 from qingfeng/up
Load videos remotely from the network
This commit is contained in:
commit
d3e8820b7b
@ -53,7 +53,13 @@
|
|||||||
|
|
||||||
- (void)setSrc:(NSString *)source
|
- (void)setSrc:(NSString *)source
|
||||||
{
|
{
|
||||||
_videoURL = [[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:source ofType:@"mp4"]];
|
BOOL isHttpPrefix = [source hasPrefix:@"http://"];
|
||||||
|
if (isHttpPrefix) {
|
||||||
|
_videoURL = [NSURL URLWithString:source];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_videoURL = [[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:source ofType:@"mp4"]];
|
||||||
|
}
|
||||||
_player = [AVPlayer playerWithURL:_videoURL];
|
_player = [AVPlayer playerWithURL:_videoURL];
|
||||||
_player.actionAtItemEnd = AVPlayerActionAtItemEndNone;
|
_player.actionAtItemEnd = AVPlayerActionAtItemEndNone;
|
||||||
_playerLayer = [AVPlayerLayer playerLayerWithPlayer:_player];
|
_playerLayer = [AVPlayerLayer playerLayerWithPlayer:_player];
|
||||||
|
Loading…
Reference in New Issue
Block a user