From 93cc1c86b53032406252d874bfc8b7a1c9c0d02f Mon Sep 17 00:00:00 2001 From: qingfeng Date: Wed, 8 Apr 2015 03:24:52 +0800 Subject: [PATCH] Load videos remotely from the network --- RCTVideo.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/RCTVideo.m b/RCTVideo.m index f4df2bf1..201d257a 100644 --- a/RCTVideo.m +++ b/RCTVideo.m @@ -53,7 +53,13 @@ - (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.actionAtItemEnd = AVPlayerActionAtItemEndNone; _playerLayer = [AVPlayerLayer playerLayerWithPlayer:_player];