You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by whitecolor <gi...@git.apache.org> on 2015/01/03 01:00:14 UTC

[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

GitHub user whitecolor opened a pull request:

    https://github.com/apache/cordova-plugin-media/pull/40

    Add Media.prototype.setRate method (only for iOS)

    This is refered to https://issues.apache.org/jira/browse/CB-8098
    Adds playback change rate feature (setRate) for iOS. To add it it Android and WP it seems not quite easy.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/whitecolor/cordova-plugin-media playback-rate

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-media/pull/40.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #40
    
----
commit c41a40dd05516ebe2f514dacd31c1f6090ada815
Author: Alex Oshchepkov <al...@gmail.com>
Date:   2015-01-02T23:54:25Z

    Add Media.prototype.setRate method (only for iOS)

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by spenceropope <gi...@git.apache.org>.
Github user spenceropope commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#discussion_r24190296
  
    --- Diff: src/ios/CDVSound.m ---
    @@ -686,6 +714,7 @@ @implementation CDVAudioFile
     @synthesize resourcePath;
     @synthesize resourceURL;
     @synthesize player, volume;
    +@synthesize player, rate;
    --- End diff --
    
    I'm getting a problem with line 717 due to "player" already being implemented in line 716.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#discussion_r22986048
  
    --- Diff: www/Media.js ---
    @@ -149,9 +149,21 @@ Media.prototype.release = function() {
      * Adjust the volume.
      */
     Media.prototype.setVolume = function(volume) {
    -    exec(null, null, "Media", "setVolume", [this.id, volume]);
    +    if (device.platform == 'iOS'){
    --- End diff --
    
    Doesn't this require the device plugin to be installed?
    Instead, you should use ``` if (cordova.platformId === 'ios') ...```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by whitecolor <gi...@git.apache.org>.
Github user whitecolor commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-70187007
  
    I've fixed it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by whitecolor <gi...@git.apache.org>.
Github user whitecolor commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-68920774
  
    Do what would you sugget to do with ```playbackRate```? create method ```setPlaybackRate``` (insteald of ```setRate```) or what? in HTML audio's ```playbackRate``` actually JS getter/setter.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by whitecolor <gi...@git.apache.org>.
Github user whitecolor commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-76014253
  
    Hey guys what about this pull is going to be merged? Are there any problems with it?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by whitecolor <gi...@git.apache.org>.
Github user whitecolor commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#discussion_r24225284
  
    --- Diff: src/ios/CDVSound.m ---
    @@ -686,6 +714,7 @@ @implementation CDVAudioFile
     @synthesize resourcePath;
     @synthesize resourceURL;
     @synthesize player, volume;
    +@synthesize player, rate;
    --- End diff --
    
    How the code should look like?
    ```objective-c
     @synthesize player, volume, rate;
    ```
    
    ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by whitecolor <gi...@git.apache.org>.
Github user whitecolor commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-68854223
  
    @purplecabbage Well I think the variant with playbackRate option for ```play``` maybe ok but lets consider this most of the platforms treats playback rate just like ```volume``` property, that can be changed at any time:
    
    1) HTML5 audio supports just a property ```playbackRate``` on ```audio``` element, that you can set anytime while playing.
    
    2) iOs supports ```setRate``` method on ```AVAudioPlayer``` object (to can be set while playing).(https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioPlayerClassReference/index.html)
    
    3) Windows Phone supports ```SpeedRatio``` property on ```MediaElement``` (http://msdn.microsoft.com/en-us/library/system.windows.controls.mediaelement.speedratio(v=vs.110).aspx)
    
    4) The problem with android: phonegap uses ```MediaPlayer``` for playing media files, but it does not support any rate change methods (an old issue https://code.google.com/p/android/issues/detail?id=1961), there is also ```AudioTrack``` class, that can be used to play media, and probably have some capabilities of chanding rate (need to be tested) but there is a problem with seeking and actually it plays only uncompressed audio (that can be taken from ```MediaPlayer``` - so the workflow with using ```AudioTrack``` is quite complicated). The is also ```SoundPool``` class that has method ```setRate```, but it has the same problems that ```AudioTrack``` class. But actually people do implement such capabilities in android (in different audiobooks playing applicatons).
    
    So I think it is reasonable to approach to ```payback rate``` just as to ```volume``` property, and as PG has method ```setVolume``` and had proposed ```setRate``` for this. What do you think?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-68914636
  
    Yeah, ```playbackRate``` is the right choice then.  Following the HTML5 audio element spec is more important than my alternative suggestion.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#discussion_r22986072
  
    --- Diff: www/Media.js ---
    @@ -149,9 +149,21 @@ Media.prototype.release = function() {
      * Adjust the volume.
      */
     Media.prototype.setVolume = function(volume) {
    -    exec(null, null, "Media", "setVolume", [this.id, volume]);
    +    if (device.platform == 'iOS'){
    +        exec(null, null, "Media", "setVolume", [this.id, volume]);
    +    } else {
    +        console.warn('media.setRate method is currently not supported for', device.platform, 'platform.')
    --- End diff --
    
    and here ... cordova-plugin-device is not a dependency, and shouldn't be


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-73211998
  
    @synthesize player, volume, rate;
    OR
    @synthesize player, volume;
    @synthesize rate;


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by whitecolor <gi...@git.apache.org>.
Github user whitecolor commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-68810775
  
    @purplecabbage ok I will add this. An importaint question: how this PR is going to be tested, and what actions should be done before it is merged into master and be included in official version?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-68922902
  
    For now just go back to ```Media.prototype.setRate = function(rate) { ...```
    But add the check for ios, to prevent crashing on platforms that do not implement it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Re: [GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by Jesse <pu...@gmail.com>.
Either way is fine.

@purplecabbage
risingj.com

On Wed, Jan 14, 2015 at 6:27 PM, whitecolor <gi...@git.apache.org> wrote:

> Github user whitecolor commented on the pull request:
>
>
> https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-70030634
>
>     Sorry, my bad, would you like me to do a rebase or fixing commit on
> top?
>
>
> ---
> If your project is set up for it, you can reply to this email and have your
> reply appear on GitHub as well. If your project does not have this feature
> enabled and wishes so, or if the feature is enabled but not working, please
> contact infrastructure at infrastructure@apache.org or file a JIRA ticket
> with INFRA.
> ---
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
> For additional commands, e-mail: dev-help@cordova.apache.org
>
>

[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by whitecolor <gi...@git.apache.org>.
Github user whitecolor commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-70030634
  
    Sorry, my bad, would you like me to do a rebase or fixing commit on top?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by shazron <gi...@git.apache.org>.
Github user shazron commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-70025695
  
    I think you added the check wrongly - you added it to setVolume?
    
    As for tests, we have a bunch of auto tests written in jasmine: https://github.com/apache/cordova-plugin-media/tree/master/tests
    .. that is run using cordova-mobile-spec (see the repo)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by whitecolor <gi...@git.apache.org>.
Github user whitecolor commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-133011855
  
    Is there a know date when the new version is going to be published?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-68811410
  
    This API has not really been discussed, but I have thought about it in the past.
    My feeling is that it would be more useful to add the playbackRate as an additional option to Media.play
    This would have the benefit of not breaking any platforms, they would simply ignore the unknown option ... and could possibly implement it in the future.
    This would however mean that you could NOT change the playback rate of a media object that was already playing.  Not sure if this was a requirement, but I think it is a reasonable trade-off as controlling playback rate of a playing media file would probably be glitchy from JS.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by whitecolor <gi...@git.apache.org>.
Github user whitecolor commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-69843977
  
    Any comments?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by whitecolor <gi...@git.apache.org>.
Github user whitecolor commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-120398353
  
    Any changes on this?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by whitecolor <gi...@git.apache.org>.
Github user whitecolor commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-73300979
  
    Fixed it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-plugin-media/pull/40


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by whitecolor <gi...@git.apache.org>.
Github user whitecolor commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-122615862
  
    Great. When it is going to be available via PG build?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-68805346
  
    I would argue that if "To add it it Android and WP it seems not quite easy." then it should NOT be added at all.
    
    The way this is implemented currently, any call to setRate on platforms other that iOS will still reach native code and potentially crash.  At a minimum, I would wrap the exec call in Media.js : Media.prototype.setRate so that it is not called on other platforms, and simply outputs NOTSUPPORTED or something.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-media pull request: Add Media.prototype.setRate met...

Posted by whitecolor <gi...@git.apache.org>.
Github user whitecolor commented on the pull request:

    https://github.com/apache/cordova-plugin-media/pull/40#issuecomment-68928992
  
    Ok, I've added, if ok with this check, how it is going to be tested?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org