Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-13704] Android: Added setTime() method to android/modules/media/src/java/ti/modules/tita... #4219

Merged
merged 2 commits into from Jul 28, 2013

Conversation

sheran
Copy link
Contributor

@sheran sheran commented Apr 27, 2013

This is my contribution to adding a setTime() method to AudioPlayer. Corresponding JIRA ticket is https://jira.appcelerator.org/browse/TIMOB-13704

@hieupham007
Copy link
Contributor

Hi Sheran,
1. setTime in this PR isn't integrated with sound, so it doesn't address https://jira.appcelerator.org/browse/TIMOB-13704. I.e, setTime(55000) would not play the sound at 55s.
2. Putting the property in propertyAccessor will automatically generate getter and setter for the property, so you don't need another @Kroll.setProperty. Also, I think this would crash in scons. You can use propertyChanged in TiUIView instead.

@sheran
Copy link
Contributor Author

sheran commented Jun 6, 2013

Hey there,

Ok, I understand what you mean. The thing is, I compiled and ran the SDK and this worked for me; no crashes. It may be likely that because I added the propertyAccessor it worked. My modified SDK is working fine for my app and I will continue to use it. I submitted the pull request in the hopes of having it tested and possibly giving back to the community. Thanks for following up with this and getting back to me.

@hieupham007
Copy link
Contributor

He Sheran,
Perhaps you forgot to commit the integration with sound? I don't see how this pull request fixes https://jira.appcelerator.org/browse/TIMOB-13704. Am I missing something here? Generally we don't merge a pull request unless it fixes a JIRA issue. Thanks for the quick reply :)

@ayeung
Copy link
Contributor

ayeung commented Jun 7, 2013

Adding the Kroll.setProperty does not crash the build. It would just overwrite the setter. However, it probably isn't necessary like @hieupham007 said since it's handled inside propertyChanged of TiSound.

Anyways, I tested the PR, and the setTime() method isn't working as expected. It doesn't seem to skip to a particular time in the stream. For me, it just always starts off from the beginning.

@sheran
Copy link
Contributor Author

sheran commented Jun 7, 2013

Hmm, ok. Not sure why this happens to you guys. Just before writing this, I used my modified SDK and tried again and it works fine. I have not tested playback from a local source, but I've tried streaming and it works. Here's the code I use:

function doPlay(e) {
    audioPlayer.addEventListener('change', handleChange);
    audioPlayer.url = "http://tenminutepodcast.com/Audio/BitKillerJones.mp3";
    audioPlayer.setTime(55000);
    audioPlayer.start();
}

This is in my alloy.js

var audioPlayer = Ti.Media.createAudioPlayer({ 
    allowBackground: true
});

As I said before, I'm happy with the results I have so far. I didn't know that adding the property into the propertyAccessor automagically created the getter and setter, so I will remove my explicit setter and test it as well. Thanks for letting me know about that.

@ayeung
Copy link
Contributor

ayeung commented Jun 10, 2013

Ok, just tested it with the new test case and it works great. If you could remove the setTime() method, I would be happy to merge in this PR.

@sheran
Copy link
Contributor Author

sheran commented Jul 15, 2013

@ayeung I've removed the setTime() method now. Sorry, didn't see your message earlier.

@hieupham007
Copy link
Contributor

Code reviewed and functionally tested. Request accepted

hieupham007 added a commit that referenced this pull request Jul 28, 2013
[TIMOB-13704] Android: Added setTime() method to android/modules/media/src/java/ti/modules/tita...
@hieupham007 hieupham007 merged commit f96f947 into tidev:master Jul 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants