Skip to content

Commit

Permalink
CB-13445 (iOS) Streaming media can take up to 8-10 seconds to start (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
purplecabbage authored Jul 10, 2018
1 parent 86660dd commit 43d57ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ matrix:
node_js: '6.14.2'
- env: PLATFORM=ios-9.3
os: osx
osx_image: xcode7.3
osx_image: xcode8.3
language: node_js
node_js: '6.14.2'
- env: PLATFORM=ios-10.0
os: osx
osx_image: xcode7.3
osx_image: xcode8.3
language: node_js
node_js: '6.14.2'
- env: PLATFORM=android-4.4
Expand Down
6 changes: 5 additions & 1 deletion src/ios/CDVSound.m
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,11 @@ - (void)create:(CDVInvokedUrlCommand*)command
// Pass the AVPlayerItem to a new player
avPlayer = [[AVPlayer alloc] initWithPlayerItem:playerItem];

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

self.currMediaId = mediaId;
Expand Down

1 comment on commit 43d57ca

@janpio
Copy link
Member

@janpio janpio commented on 43d57ca Nov 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ptykamikaze Issues can be created here: https://github.com/apache/cordova-plugin-media/issues Include a link to this PR if you think this caused a regression.

Please also don't post the same comment in multiple places.

Please sign in to comment.