Discussion Forums  >  Audio, Video, Playing, Recording

Replies: 23    Views: 101

RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
01/05/13 03:19 AM (11 years ago)

Audio / Image Embed Question

Hi, First: I'm developing an Android app. I'm experimenting with my first test app and added an image url and a "play audio" button with a sound file url to one of my html screens. It didn't display properly on my AVD so I was adviced to run my testapp on an actual device. Running on a device the screen shows the image perfectly fine. It also displays the play audio button and it even plays the sound when tapped (yaay!) It does, however, not play the sound when the device is offline. That should make sense because one needs to be online to get to the audio file url. Now here's my question: When offline, why does my app display the image but not play my sound? I mean, both files are stored somewhere in cyberspace, right? Yet, one of them apparently can be accessed and one them can't. I'm puzzled... Thx in advance, Robin
 
volley
Aspiring developer
Profile
Posts: 37
Reg: Feb 19, 2011
Amsterdam
10,570
like
01/05/13 03:45 AM (11 years ago)
Hi Robin, Maybe the image is in the cache and the sound needs to be streamed. Just a thought. BTW I'm from Amsterdam too. Not many Dutchies here, good thing you joined! Volley
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/05/13 04:11 AM (11 years ago)
Hi Volley, Funny how I just read a post on this forum from a Dutchie who joined a few days ago, then I post this question and the first to answer is a third Dutchie. So much for thinking I was the only one :-) I'm not sure I understand your reply, though. Are you telling me the sound NEEDS to be streamed at all times? That's hard to believe since there are so many apps around that play sound offline. The mp3 file is tiny as can be so I don't see the need for streaming... Whatever the reason is, I need my app to be able to run completely offline since my target group will use this app in places where wifi will be absent most of the times and their financial situation won't allow for using the internet through their phone subscription. Looking at your profile: have you joined long ago and only just really started or are you laying low on BT site? I'm interested to read about your experiences and accomplishments with BT. Info is Key! Robin
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
01/05/13 04:19 AM (11 years ago)
I believe @Volley is correct. You can make it so the app can play the audio when offline, by adding the audio file into your eclipse project. If you want to that is... Cheers, Alan
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/05/13 04:24 AM (11 years ago)
Thx for the info, both of you! So, am I understanding correctly that image files get included into a project automatically and audio files don't? Robin
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
01/05/13 04:26 AM (11 years ago)
Hi Robin, Another Dutchie here..... I don't have any experience with Android but if you want to play the file localy you have to drag it into the source code and make your button to point at the internal/local file. Example external: Http://www.yourserver.com/ mysound.mp3 Example local: mysound.mp3 Make sure the filenames are all lowercase. Android seems to have trouble if you don't. Hope this helps. Best Regards, Danny
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/05/13 04:44 AM (11 years ago)
Thx for the info, both of you! So, am I understanding correctly that image files get included into a project automatically and audio files don't? Robin
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
01/05/13 04:58 AM (11 years ago)
Hi Robin, If you want to use files (either audio or images) localy you have to include them in eclipse manually in the appropriate folder(s). As said before by Volley the thing you are experiencing now could be due to the caching of files. You can probably test it by deleting the app from your device and install again (so you have a fresh install). Best Regards, Danny
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/05/13 04:58 AM (11 years ago)
Thx for the info, both of you! So, am I understanding correctly that image files get included into a project automatically and audio files don't? Robin
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/05/13 05:14 AM (11 years ago)
As I understand it, Image files and Audio files (and html files, and probably all the others too) need to be added 'by you' in the eclipse environment if you want them available offline. online HTML and Images 'can be cached' for offline use, depending on the type of plugin. Sorry, I'm not Dutch ;) Cheers! -- Smug
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/05/13 05:15 AM (11 years ago)
Thx for the info, both of you! So, am I understanding correctly that image files get included into a project automatically and audio files don't? Robin
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
01/05/13 05:19 AM (11 years ago)
Hi Robin, Please do not refresh your browser if your latest action was making a post. By refreshing the browser you add your post over and over again.... Best Regards, Danny
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/05/13 05:25 AM (11 years ago)
Thx, I was wondering about that ;) I understand about adding files manually in Eclipse enviroment for it to work offline. But it doesn´t seem to be neccessary for image files (since it displays my image when offline) but it IS for audio files (since it doesn't play the audio file when offline, not even when I reinstall my app on my device). I will add the audio files manually in Eclipse environment. I just want to know whether I HAVE to do the same for images or not before I actually start building (don't want to redo stuff halfway). Robin
 
volley
Aspiring developer
Profile
Posts: 37
Reg: Feb 19, 2011
Amsterdam
10,570
like
01/05/13 06:04 AM (11 years ago)
@robin: Yes I was "off" for a while doing non-app and non-BT things, recently picked it up again and have now 1 app waiting for review in the appstore. 2 More already in. Until now iOs only, I will start soon with android. I will definitely become a member to enjoy all the new goodies coming up. About the offline issue: many answers already in this post. I'd say: just include all the files, also the images, in your project to make sure they are always available and not depend on caching.
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/05/13 06:16 AM (11 years ago)
;) Chrs! Love to know the names of your apps already in Appstore to check them out... Robin
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
01/05/13 06:50 AM (11 years ago)
You should be able to write some custom code that saves the audio file to the device once it's downloaded, and then some to check if the file already exists before downloading again.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
01/05/13 07:56 AM (11 years ago)
Hi Robin To answer your (often refreshed) question :- If you have the images as URL's, to use them, you *have* to be online the first time they are a called, thereafter, they are cached in your app. If anything breaks your cache, you need to go online again to get them. If you include the images in the project, then you *never* need to be online to use them. I believe audio files are never cached, so if you can include them in the project, things would be faster. What @chris1 says may be true, but I try to avoid writing custom code, I am no good at it. Cheers, Alan
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/05/13 08:00 AM (11 years ago)
That's the confirmation of what I already thought. I also avoid writing code. Not because I hate it or because I don+t know how... I just tihnk less is always more. Thx, now I can proceed! Robin
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
01/05/13 08:33 AM (11 years ago)
Hi @RobinvanKrieken, First, your image and audio file in the same url? Second, how many audio files you want to play? Third, I am working on a plugin that plays your audio file off your sd card. Would this be something your looking for? If so, I might be able to assist you with our code. LA
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/06/13 07:06 AM (11 years ago)
Hi LA, @1: nope, completely different. @2: say, 100+ audio files of about 5 secs each. @3: I don't know. It sounds interesting, but what does that mean exactly? Do I understand correctly that it that case all audio files will automatically be downloaded onto someone's sd card after donwloading the app? >>> My app is... let's say it's the same as all those language dictionaries where you can play audio files to hear the words being spoken. Any idea what the best course of action would be? Thx in advance! Robin
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
01/06/13 09:45 AM (11 years ago)
Hey @@RobinvanKrieken, I can help you code where it just streams directly from your link that's no problem, but you might run into the same problem when off line. Either way, your going to have to put the sound into your project. Email me on here and we can go from there if you like? LA
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/06/13 10:12 AM (11 years ago)
@LA: Not sure if I understand you all the way but that's OK. 1: I realised I will have to include the files into my project. My app will be used mostly offline so streaming wouldn't be an option (or am I wrong here?) Those files will need to be on the user's device for that, right? 2: I appreciate all the help I can get when needed, thanks for the offer. I will definitely get back to you on that one! (For now, I am still in the designing and sketching phase all the while experimenting with creating an app with the functionalities and screen neccessary for it to work as I see it in my brain :) ) 3: (Because adding audio wasn't an option as a free member I upgraded to Member today so I can add all files to my projects.) Now looking into installing my BT control panel. I'd like to run it all on my local server (mamp) so I can test it in my own environment. I can't find anything on that subject, though. Do you happen to know if that is just not an option? Hope you can help me out wih these questions or point me in the right direction. Thx in advance Robin
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
01/06/13 10:37 AM (11 years ago)
When you include the audio in your project then they will be on the users device. There are so many different ways you can go with this so when your ready just let me know. I run pc so not familiar with mamp. When you get past the point of designing and sketching, which is always a great idea, you might decide to go another way or figure out your own solution. Either way, I'm here for you. LA
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
01/06/13 11:37 AM (11 years ago)
If you won't need to add/change audio files then loading them at build time is def. best. If you'll need to add more after build URL with automatic saving to device is your best bet. What plugin are you using to do all this?
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.