[
https://issues.apache.org/jira/browse/CB-4813?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13844509#comment-13844509
]
Alberto Pettarin commented on CB-4813:
--------------------------------------
Hi, some piece of information that might be useful to the maintainers.
First of all, the JS/native interface is a bit messy. Sometimes you pass/get
seconds, sometimes milliseconds. I suggest to unify the unit, and to clearly
state it in the documentation.
I worked around this bug in the following way:
Android:
In AudioPlayer.java, commented out the two occurrences of:
this.seekOnPrepared = 0;
iOS:
Simply play() and pause() in your JS before seeking:
m = new Media(yourfile);
m.setVolume('0.0');
m.play();
m.pause();
m.setVolume('1.0');
m.seekTo(10000);
m.play();
Note 1: this is not enough in Android, you need to patch the Java source code.
Note 2: it might be quite probable that also CDVSound.m suffers from the same
logic problem of the Android version, so you might want to investigate its
parts that manage the "seek before first play" event.
Finally, let me remark that these are very quick-and-dirty workarounds; the
maintainers might want to investigate/refactor deeper in the source code.
> Media.seekTo on first play. Again
> ---------------------------------
>
> Key: CB-4813
> URL: https://issues.apache.org/jira/browse/CB-4813
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin Media
> Affects Versions: 2.7.0, 2.9.0, 3.0.0
> Environment: Mac OS X
> Reporter: Snr
>
> It is impossible to use Media.seekTo before the sound is played the first
> time.
> There was the same issue previously which was fixed in 2.1.0:
> https://issues.apache.org/jira/browse/CB-403
> However, I still can replicate the problem: the sound always starts playing
> from the beginning of the file.
> var audio = new Media("data/q.mp3",function(){},function(){},function(){});
> audio.seekTo(30000);
> audio.play();
--
This message was sent by Atlassian JIRA
(v6.1.4#6159)