Closed GoogleCodeExporter closed 9 years ago
Original comment by megbec...@gmail.com
on 26 Jun 2009 at 2:04
The following thread explains/points out that VideoView can only handle paths
and uri
not resource ids.
http://groups.google.com/group/android-developers/browse_thread/thread/de2ca9f5e
302d757/b891f66aeef79001?hl=en&q=android+videoview#b891f66aeef79001
Two options:
1) Create a routine at start of the game to check that the video is on the
sdcard. If
it is continue, if it isn't copy the bits over from the resource file.
2) Create our own video view using MediaPlayer
Original comment by Morrison...@gmail.com
on 26 Jun 2009 at 6:57
Try this...
1. Create a new VideoView using the constructor that just takes a Context.
2. Use the static factory method on MediaPlayer, create(Context context, int
resid),
using the resId of the video.
3. Call the setDisplay method on the newly created MediaPlayer, passing the
VideoView.
4. Voila!
Let me know if that doesn't work.
Original comment by megbec...@gmail.com
on 26 Jun 2009 at 3:10
Tried it. Didn't work.
Went back to APIDemos from the SDK samples and verified that using a resid in
the
static factory of MediaPlayer like audio doesn't work with video.
Also tried a variation with AssetFileDescriptor as shown below without success.
AssetFileDescriptor afd = getResources().openRawResourceFd(R.raw.passthedrink);
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setDataSource(afd.getFileDescriptor());
I'm thinking two possibilities now:
1) On pages 40-41 of the Google IO session on media framework:
http://dl.google.com/io/2009/pres/Mastering_the_Android_Media_Framework.pdf
there is a mention of for security reasons only allowing access to the SD card.
Perhaps video isn't allowed since the codecs are more complicated than audio.
2) Video from the apk is intentionally disabled for performance reasons. Access
to
flash ROM is okay for audio rendering but the bandwidth requirements for video
would
kill the O/S??
Fallback solution is still to copy the video bits onto the SD card.
Original comment by Morrison...@gmail.com
on 29 Jun 2009 at 7:43
Or the android packager puts them in a compressed state even though it is in
the raw
directory
http://groups.google.com/group/android-beginners/browse_thread/thread/9bb4f25b67
16f06f/8192d25b7b2fe4d2?q=video+from+raw+resource#8192d25b7b2fe4d2
Original comment by Morrison...@gmail.com
on 29 Jun 2009 at 7:53
sigh I have to set all these issues to notify me... anyway just seeing these
now and
attempted at the same solutions as well (although AssetFileDescriptor looked
most
promising - we just have to replace VideoView with our own versio that copies
to a
temp file or the app's files folder).
Copying to sdcard just requires another permission which imo is a put off when
trying
out a new game.
I checked in my commented out attempts as before
Original comment by dario.nycjava@gmail.com
on 29 Jun 2009 at 8:15
I've also been playing with it the past few days and have come to many of the
same
conclusions, however, if you put the video into the assets folder, instead of
the
res/raw folder, then I don't believe it gets compressed.
I see what the Google I/O presentation says about the Media Server only having
access
to the SDCard, however, it also provides the AssetManager code example of
playing a
file directly from a resource. I'd like to think they tested their code before
putting it on the slide, and wonder if they are differentiating between a media
player and the media server. :o)
Having said all of that, rather than burn all of our cycles on the "get ready"
screen, copying to the SDCard is perhaps the easiest way to go.
Original comment by megbec...@gmail.com
on 29 Jun 2009 at 8:18
BTW, here is the thread that makes me think it should be possible.
http://groups.google.com/group/android-developers/browse_thread/thread/666889885
6f8f090
Original comment by megbec...@gmail.com
on 29 Jun 2009 at 9:20
AssetFileDescriptor -> MediaPlayer
Original comment by dario.nycjava@gmail.com
on 30 Jun 2009 at 12:45
marking all previously done issues as verified
Original comment by dario.nycjava@gmail.com
on 1 Oct 2010 at 3:49
Original issue reported on code.google.com by
megbec...@gmail.com
on 26 Jun 2009 at 1:29