| Reply | « Previous Thread | Next Thread » |
|
I want to find out the way that MMAPI play media through InputStream.
So I made an adapter to wrap the real InputStream: InputStream is = getClass().getResourceAsStream("x.mpg"); mis = new MyInputStream(is); p = Manager.createPlayer(mis, "video/mpeg"); p.realize(); p.prefetch(); ..... p.play(); I run the code on Emulator. class MyInputStream simply wraps InputStream and make some output to help me find which InputStream method is called and when called. When p.realize() is called, as a result, the InputStream.read() is called many times, and I find that all data in x.mpg is read. After realize returned , no more stream method called. There must be a large buffer to hold the data, but on real device, its imposible. So I'm wondering what happens on real device. Will the data be read only when needed? Read some data, play it , then read more, then play? And how about CreatePlayer through http? thanks. |
|
The InputStream supports native media player (i.e. a mobile OS component which is actually processing media on mobile phone) with the data from the specifyed source. InputStream is the basic way to support media player with data. However, there are other ways to support media player with data (through URL and customized DataSources), but they all are finally utilizing InputStream(s).
The realize() method simply does a connection to the media, and retrieves enough information about it (length, video size, sound quality, etc.) The prefetch() method produces enough data (i.e. frames and audio data) to start the playback, but nothing more. The start() method starts playback and launches process of producing new video frames and audio data, so we can see video or listen to audio in our mobile phones. The native media player implementation is hidden from the user (and Java), and vary from mobile platform to mobile platform. The internal data buffers are no exception. The only main feature of the Java mobile player is amount of supported formats and mediums. Also there is a "progressive downloading" feature which becomes highly available on many mobile platforms. It allows to play media while it wasn't yet fully downloaded (either from local file or from the network). Of course, it's implementation is hidden from the Java programmers. The old mobile platforms are usually loading media-file into the memory before they will start playing it, but such functionality is still presented even on some new mobile phones. In this case to play a big media file with Java player, you must ensure that mobile phone's memory heap-size is bigger than your media file's size.
Last edited by axs : 2007-04-05 at 09:32.
|
|
Does anyone know if it is possible to create a custom DataSource and SourceStream that would assist in speeding up the process of loading a video file into the media player off a phones storage?
I have a similar issue as described above where I find when I pass a stream to the Manager.createPlayer that it loads the whole file into memory before playing and this can take a while on a 2-3MB file. |
|
Quote:
|
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Recording in Amr Format | losym | Symbian Media (Graphics & Sounds) | 12 | 2009-03-26 07:41 |
| cannot able to play a video file. | shalini.mishra | Mobile Java Media (Graphics & Sounds) | 3 | 2006-11-13 17:54 |
| SIP content type | hlothman | Symbian Networking & Messaging | 8 | 2006-05-17 10:26 |
| can't play file from inputstream (no ending) | aluckybird | Mobile Java Media (Graphics & Sounds) | 3 | 2005-12-02 08:49 |
| How to play media files with the video player utility? | huwell | General Symbian C++ | 0 | 2005-06-08 11:19 |