RandomCoder Well-Known Member Licensed User Longtime User Aug 23, 2014 #1 Has something changed? I'm trying to add the position property to the Audio library as per this forum post... MediaPlayerStream - SeekTo and getCurrentPosition It appears that others have initailly had problems getting the property to show but they have then got it to work. I've followed the instructions meticulously... You should do as follow: 1- Close B4A Application 2- Go to the installation folder of B4A App 3- Go to Library Folder 4- Replace the Audio.xml file I provided previously. In case you don't want to replace rename the current file and copy mine as well. 5- Open B4A App and load your project. 6- just call mp.Position and it should be available now. Click to expand... But still I can not get the property to show. Has the .jar file changed with Audio lib version 1.63? I realise that even if I manage to get the property to be listed, it still might not work on my device, but i'd like to give it a try if at all possible. Attached is the modified Audio.XML file (renamed file extension due to forum rules) I am attempting to use. I've manually added the position property in the MediaPlayerStream Class and refreshed the audio lib. What else can I be doing wrong? All suggestions gratefully received, thanks. RandomCoder Attachments Audio.txt Audio.txt 23.6 KB · Views: 711
Has something changed? I'm trying to add the position property to the Audio library as per this forum post... MediaPlayerStream - SeekTo and getCurrentPosition It appears that others have initailly had problems getting the property to show but they have then got it to work. I've followed the instructions meticulously... You should do as follow: 1- Close B4A Application 2- Go to the installation folder of B4A App 3- Go to Library Folder 4- Replace the Audio.xml file I provided previously. In case you don't want to replace rename the current file and copy mine as well. 5- Open B4A App and load your project. 6- just call mp.Position and it should be available now. Click to expand... But still I can not get the property to show. Has the .jar file changed with Audio lib version 1.63? I realise that even if I manage to get the property to be listed, it still might not work on my device, but i'd like to give it a try if at all possible. Attached is the modified Audio.XML file (renamed file extension due to forum rules) I am attempting to use. I've manually added the position property in the MediaPlayerStream Class and refreshed the audio lib. What else can I be doing wrong? All suggestions gratefully received, thanks. RandomCoder
Erel B4X founder Staff member Licensed User Longtime User Aug 24, 2014 #2 You can use JavaObject: Code: Copy Dim jo As JavaObject = mps Log(jo.RunMethod("getPosition", null)) Upvote 0
RandomCoder Well-Known Member Licensed User Longtime User Aug 29, 2014 #3 Erel said: Code: Copy Dim jo As JavaObject = mps Log(jo.RunMethod("getPosition", null)) Click to expand... This works perfectly but can someone explain to me why it is "getPosition" and not "getCurrentPosition" as I am trying to better understand my code and how it all works. The documentation for the RunMethod states to use the case-sensitive Method name and I expected this to be getCurrentPosition as listed in the Android documentation for the MediaPlayer class... http://developer.android.com/reference/android/media/MediaPlayer.html I tried using getCurrentPosition but this caused an error and made reference to the B4A wrapper. Therefore I'm thinking that getPosition must be something to do with B4A and not the MediaPlayer class? Confused! RandomCoder Upvote 0
Erel said: Code: Copy Dim jo As JavaObject = mps Log(jo.RunMethod("getPosition", null)) Click to expand... This works perfectly but can someone explain to me why it is "getPosition" and not "getCurrentPosition" as I am trying to better understand my code and how it all works. The documentation for the RunMethod states to use the case-sensitive Method name and I expected this to be getCurrentPosition as listed in the Android documentation for the MediaPlayer class... http://developer.android.com/reference/android/media/MediaPlayer.html I tried using getCurrentPosition but this caused an error and made reference to the B4A wrapper. Therefore I'm thinking that getPosition must be something to do with B4A and not the MediaPlayer class? Confused! RandomCoder
Erel B4X founder Staff member Licensed User Longtime User Aug 31, 2014 #4 B4A MediaPlayer is a class in the Core library. The native MediaPlayer is a field in that class. In this case you are not accessing the native MediaPlayer directly. If the object was a "wrapper" object (like all views) then you would have had direct access to the native object. Upvote 0
B4A MediaPlayer is a class in the Core library. The native MediaPlayer is a field in that class. In this case you are not accessing the native MediaPlayer directly. If the object was a "wrapper" object (like all views) then you would have had direct access to the native object.
Erel B4X founder Staff member Licensed User Longtime User Nov 4, 2014 #5 Are you able to stream the file with MediaPlayerStream? You can try: Code: Copy Dim jo As JavaObject = mps jo.RunMethod("setPosition", Array(3000)) 'milliseconds Upvote 0
Are you able to stream the file with MediaPlayerStream? You can try: Code: Copy Dim jo As JavaObject = mps jo.RunMethod("setPosition", Array(3000)) 'milliseconds