Aug 29 | 7:25 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Aug 29 | 7:45 PM |
Ron | has entered the room |
Ron |
Hello to all!
|
Mark M. |
hello, Ron!
|
Mark M. |
how can I help you today?
|
Ron |
View paste
|
Mark M. |
well, I always yell at people for using concatenation to create file paths
|
Ron |
What is a better way?
|
Mark M. |
use new File(Environment..., "sound1.ogg") to get the File
|
Mark M. |
then convert that using getAbsolutePath() to a String
|
Aug 29 | 7:50 PM |
Mark M. |
that way, you are protected no matter whether the directory name has a trailing / or not
|
Ron |
OK, I think I remember something about that (this is some old code I wrote 2 years ago) Any other suggestions?
|
Mark M. |
otherwise, what you have seems OK
|
Mark M. |
though I haven't used SoundPool personally
|
Ron |
What do think about Media Player?
|
Mark M. |
I typically think of reserving SoundPool for overlapping sounds, like game sound effects
|
Mark M. |
MediaPlayer should work fine, if SoundPool continues to give you grief
|
Ron |
We aren't playing music per se, just short notification sounds (clicks, beeps, etc).
|
Ron |
Media Player says that it loads the sound in-line each time you play it, is that true?
|
Mark M. |
yes
|
Ron |
We would be concerned about multiple load times even though the sounds are short.
|
Mark M. |
then try using the File constructor and see if it helps
|
Ron |
Does the media player play method spawn off it's own thread or do we need to provide threading?
|
Mark M. |
looking at the source code to SoundPool, they just
turn around and create a File from the path anyway, if it doesn't start
with http:/
|
Mark M. |
MediaPlayer is automatically asynchronous for playback
|
Aug 29 | 7:55 PM |
Mark M. |
for loading the clip, you call prepare() (blocking) or prepareAsync() (non-blocking)
|
Ron |
On the prepareAsync is there a callback to let us know when it is prepared?
|
Mark M. |
yes
|
Mark M. |
BTW, it is impossible for load() on SoundPool to return null, as the return type is int
|
Ron |
Sounds good, I think we have enough to continue with, Thanks for the help. Over and out.
|
Ron | has left the room |
Elad G. | has entered the room |
Mark M. |
hello, Elad!
|
Mark M. |
how can I help you today?
|
Elad G. |
Hey!
|
Elad G. |
first of all
|
Elad G. |
I love the book
|
Mark M. |
great! thanks!
|
Elad G. |
It's 3AM here right now(I stayed up this late to speak with you)
|
Mark M. |
yeesh!
|
Aug 29 | 8:00 PM |
Mark M. |
I have some more friendly hours for you next week, then
|
Elad G. |
So, I want to ask you about cwac camera
|
Elad G. |
two things
|
Mark M. |
sure! go ahead!
|
Elad G. |
The first: Im trying to implement an Instagram
like app for my company-> I don't need to much options- just the
flash, autofouces and rotate camera and ofcourse previewing the picture
to the user before he shoots the photo
|
Aug 29 | 8:05 PM |
Mark M. |
um, well, that should be OK with CWAC-Camera as it
stands, assuming that by "rotate camera" you mean "support portrait and
landscape"
|
Mark M. |
I am still slogging through trying to determine which cameras need extra help with the portrait mode images
|
Mark M. |
the way most Samsung and Motorola devices do
|
Mark M. |
but your app should not need to worry about that -- that's my job in the library
|
Elad G. |
View paste
|
Mark M. |
do you mean the resolution of the pictures that you take?
|
Elad G. |
no
|
Elad G. |
the preview
|
Elad G. |
It's not as sharp as I want it to be
|
Mark M. |
the preview image resolution that is chosen by
default is based on a few criteria, including the aspect ratio of the
desired picture resolution
|
Mark M. |
you are welcome to override that in your
CameraHost implementation (or SimpleCameraHost subclass) to use any
valid preview resolution
|
Aug 29 | 8:10 PM |
Mark M. |
you might also wish to have mayUseForVideo()
return false, as that drives SimpleCameraHost to use
getPreferredPreviewSizeForVideo(), and I have had reports that this does
not give a great result on some devices
|
Mark M. |
this is covered at https://github.com/commonsguy/cwac-camera#contr...
|
Elad G. |
you beat me to it..
|
Elad G. |
:)
|
Elad G. |
I did all of the above
|
Elad G. |
I have a nice resolution now
|
Elad G. |
but not perfect
|
Mark M. |
I do not know what "perfect" would be, and I have even less idea how to help you get it
|
Elad G. |
I'll play with it more
|
Elad G. |
for me perfect is more sharp
|
Elad G. |
like the android camera
|
Elad G. |
the native one
|
Mark M. |
then choose a higher preview resolution
|
Elad G. |
I choose the highest -> Im using a nexus 4 for my tests-> and I get 720X1280
|
Aug 29 | 8:15 PM |
Mark M. |
then, by definition, that is all the better you can get
|
Elad G. |
cool
|
Elad G. |
the second thing->
|
Elad G. |
Today I while debuggin my app on my nexus 4-> I
left the camere fragment opened for a while, acouple of times. after
Clicking shoot photo-> my device restarted!!
|
Elad G. |
It didn't happend once
|
Elad G. |
4-5 times
|
Elad G. |
I didn't fully implemented the save photo to disk option
|
Mark M. |
well, a device restart means a firmware bug -- there's nothing that we can do in an app that would cause that
|
Mark M. |
if, at some point, you can give me steps that are
assured to reproduce the problem, I will see if I can get it to happen
on my Nexus 4
|
Mark M. |
for example, if you can get this to happen with one of the demo apps
|
Elad G. |
Ok
|
Elad G. |
Two more
|
Aug 29 | 8:20 PM |
Elad G. |
after shooting the photo -> I want to crop the
visible parts to the user(as I said I hide some parts with colored
relative layouts), how would you suggest I implement this?
|
Mark M. |
Bitmap.createBitmap()
|
Mark M. |
https://developer.android.com/reference/android..., int, int, int, int)
|
Mark M. |
or http://goo.gl/qSHP5A since that link didn't work
|
Elad G. |
offset is where I start?
|
Elad G. |
sorry
|
Elad G. |
Wrong method
|
Elad G. |
:)
|
Elad G. |
cool
|
Mark M. |
yeah, there are several createBitmap() flavors
|
Elad G. |
Last question
|
Ron | has entered the room |
Elad G. |
I add an overlay to the image I have
|
Mark M. |
(BTW, howdy, Ron -- be with you shortly!)
|
Ron |
Hello, I'm back for more
|
Elad G. |
Say a crown that you can place on someone's had
|
Elad G. |
when I crop my Image I want to crop the crown with it
|
Elad G. |
should I use the same method as above?
|
Mark M. |
um, I guess so
|
Mark M. |
if your end objective is to save a merged bitmap, with the photo and the crown, you might consider merging them before cropping
|
Elad G. |
How do I do that?
|
Aug 29 | 8:25 PM |
Mark M. |
the only way I know off the top of my head would be to do it by hand, pixel by pixel
|
Mark M. |
but I have never really researched this point
|
Elad G. |
ok
|
Elad G. |
Ill check it up
|
Elad G. |
and about the bug
|
Elad G. |
Ill try reproducing it
|
Mark M. |
OK
|
Elad G. |
10x for all!!
|
Mark M. |
you are very welcome
|
Mark M. |
Ron: do you have another question?
|
Ron |
View paste
|
Mark M. |
what exactly are your symptoms?
|
Ron |
returns a 0 value for the soundID
|
Ron |
We did verify that the file is in the downloads directory
|
Mark M. |
I take it that 0 is an invalid sound ID?
|
Mark M. |
the docs do not say that's the case, which is why I ask
|
Mark M. |
and, have you checked LogCat?
|
Ron |
hmmm, we were under the impression that 0 was invalid. we will check on it. You can proceed on to next user
|
Ron |
We will check logcat as well.
|
Mark M. |
the one way I see that it would return 0 is if
there's an exception reading the file, and there should be a message in
LogCat for that
|
Ron |
Gotcha, we will check on it.
|
Mark M. |
well, that's a wrap for today's chat
|
Mark M. |
the transcript will be posted shortly to http://commonsware.com/office-hours/
|
Ron | has left the room |
Mark M. |
the next chat is Tuesday, 4pm Eastern
|
Mark M. |
have a pleasant, er, night! :-)
|
Aug 29 | 8:30 PM |
Elad G. | has left the room |
Mark M. | turned off guest access |