cordova-plugin-media
cordova-plugin-media copied to clipboard
fix(android): avoid seeking on media without duration (CB-11314)
On Android >= 6.0, live streams do not start playing. This is because the onPrepared method of AudioPlayer invokes seekTo, what leads to an error because live streams have no duration and hence can not be seeked.
Cordova CI Build has one or more failures.
Commit - Link Dashboard - Link
| Builder Name | Console Output | Test Report | Device Logs |
|---|---|---|---|
| Windows 8.1 Store | Link | Link | Link |
| Windows 10 Store | Link | Link | Link |
| Windows 8.1 Phone | Link | Link | Link |
| iOS | Link | Link | Link |
| Android Mac | Link | Link | Link |
This is also a problem with MP3 files where android (for whatever reason) cannot read the duration of the file. This could be some slight corruption to the file over time or it could be simply an encoding format that android doesn't like. This is pretty well documented with people having to work around the same issue in native audioplayers that use the same underlying frameworks.
I went insane trying to figure out why iOS would seek within a local file but Android intermittently wouldn't.
I'm definitely going to give this PR a test!
There is a merge conflict now @schoetty. Could you maybe fix that please? Thanks.