Office Hours — Today, March 23

Thursday, March 18

Mar 23
7:55 PM
Mark M.
has entered the room
Mark M.
turned on guest access
8:00 PM
Jonathan
has entered the room
Mark M.
howdy!
Jonathan
Hello Mark!
I have an app that has quite a bit of audio content
I plan on deploying the audio to the sdcard by downloading from the net
Mark M.
OK
Jonathan
but I want to encrypt it on the card and decrypt it in the app before playback
(it would come from the net encrypted)
how do I do this securely? If I store the key in the program, can it be obtained by examining the apk file?
Mark M.
yes
basically, you're trying to do DRM
Jonathan
yup
Mark M.
that's the sort of thing that really big businesses try to do...and they get hacked quickly
Jonathan
haha
Mark M.
so, I don't know of a solution here
Jonathan
Okey doke.
8:05 PM
Mark M.
sorry
Jonathan
No worries. I thought it might be like that...
8:10 PM
Jonathan
Thanks for your help. I'm going to look through my notes and see if I can boil down my other issues into some questions before office hours are over. :)
Mark M.
ok
8:25 PM
Jonathan
I spent quite a bit of time wrestling with the MediaPlayer and getting into trouble with making calls to the MediaPlayer in the wrong state. I admit that most of my problems come from the fact that I have not yet implemented all the Listeners for the MediaPlayer to keep track of state.
Do you have any advice on how to handle a MediaPlayer which will play multiple clips from a loop within an AsyncTask?
Mark M.
Um
the clips are sequential?
Jonathan
Yes, sequential.
I call play, then sleep the AsyncTask
Mark M.
the completion listener should cover it, then
ick
not a big fan of sleep()
Have AsyncTask kick off the first clip
Jonathan
:) What would you reccomend?
Mark M.
have the completion listener kick off the next cliip
er, clip
only have the AsyncTask start your playback chain -- let each clip's completion start up the next
8:30 PM
Jonathan
AsyncTask is iterating through several of these playback groups
hence the sleep.
Mark M.
I don't see why that matters
whether is is two clips or 20, they're all in sequence, right?
Jonathan
I'm thinking...
slowly.... :)
Mark M.
I figured you were on dialup... :-)
Jonathan
LOL
8:35 PM
Jonathan
It's a yoga app
playing audio per pose
with various ammounts of time per pose
Mark M.
ok
Jonathan
defined by the user.
so sometimes all we can do is say the nae before it's time to transition to the next pose
Mark M.
"say the nae"?
is this is Scottish yoga app?
Jonathan
name
haha
other times we have more time available to give pointers or goals for the pose. intructions,if you will
Mark M.
ok
user queues up a set of positions and goes through them?
Jonathan
It's nice to have some silence too. :)
Mark M.
s/positions/poses/
Jonathan
yes
Mark M.
ok, here's how I'd do it
Jonathan
with times per pose
Mark M.
Step #1: In the activity, when the user says "start", you do two things
Step #1a: you start playing back the first clip in the set for this pose
Step #1b: you call postDelayed() on a Handler or View to be notified when the user's chosen time for the pose ends
Step #2: in the completion listener for the MediaPlayer, if there are more clips in this set, start the next clip
Step #3: in the Runnable you passed to postDelayed(), you stop and reset the MediaPlayer, kick off the clip for the 2nd pose, and postDelayed() the Runnable for the 2nd pose's time
Step #4: lather, rinse, repeat
no AsyncTask, no sleep()
8:40 PM
Jonathan
OK.
We stop the MediaPlayer in the postDelayed() Runnable in case we've played the audio past our poses time limit, yes?
Mark M.
yes
this way, the audio ends either when you run out of clips for the pose, or the pose's user-set time ends, whichever comes first
Jonathan
Okey dokey. I'll mull this over.
yes
Great, thanks again!
Mark M.
happy to help
8:45 PM
Jonathan
I have to tell you that I just recently bought my subscription and it was these office hours that convinced me. What a great idea!!
Mark M.
I just keep trying to add value
which reminds me, the next edition of the Advanced Android book rolls out tomorrow, barring unforeseen problems
Jonathan
That and the fact that almost every time I search for something android related you're the one giving the solution. :)
ooh, great!
OK, I have lots to re-write now, so I'll say goodbye. :) Have a great night!
Mark M.
you too
8:50 PM
Jonathan
has left the room
Mark M.
turned off guest access

Thursday, March 18

 

Office Hours

People in this transcript

  • Jonathan
  • Mark Murphy