Skip to content

Commit 43d57ca

Browse files
CB-13445 (iOS) Streaming media can take up to 8-10 seconds to start (#169)
* iOS streaming media can take up to 8-10 seconds to start. This fix allows streaming media to start right away. Caveat: on a slow internet connection there might be pauses for buffering (depends on size+length of media). * include check for iOS version so we don\'t break iOS<10. Thanks @ghenry22 * bump travis CI xcode versions
1 parent 86660dd commit 43d57ca

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ matrix:
2626
node_js: '6.14.2'
2727
- env: PLATFORM=ios-9.3
2828
os: osx
29-
osx_image: xcode7.3
29+
osx_image: xcode8.3
3030
language: node_js
3131
node_js: '6.14.2'
3232
- env: PLATFORM=ios-10.0
3333
os: osx
34-
osx_image: xcode7.3
34+
osx_image: xcode8.3
3535
language: node_js
3636
node_js: '6.14.2'
3737
- env: PLATFORM=android-4.4

src/ios/CDVSound.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,11 @@ - (void)create:(CDVInvokedUrlCommand*)command
265265
// Pass the AVPlayerItem to a new player
266266
avPlayer = [[AVPlayer alloc] initWithPlayerItem:playerItem];
267267

268-
//avPlayer = [[AVPlayer alloc] initWithURL:resourceUrl];
268+
// Avoid excessive buffering so streaming media can play instantly on iOS
269+
// Removes preplay delay on ios 10+, makes consistent with ios9 behaviour
270+
if ([NSProcessInfo.processInfo isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10,0,0}]) {
271+
avPlayer.automaticallyWaitsToMinimizeStalling = NO;
272+
}
269273
}
270274

271275
self.currMediaId = mediaId;

0 commit comments

Comments
 (0)