You Are Here:

Community: Developer Discussion Boards

#1 Old What happens when play media from InputStream? - 2007-04-02, 16:47

Join Date: Mar 2007
Posts: 12
Molewy
Offline
Registered User
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.
Reply With Quote

#2 Old Re: What happens when play media from InputStream? - 2007-04-05, 09:22

Join Date: Aug 2006
Posts: 307
axs
Offline
Regular Contributor
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.
Reply With Quote

#3 Old Re: What happens when play media from InputStream? - 2007-04-09, 00:24

Join Date: Jul 2005
Posts: 48
sinkers
Offline
Registered User
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.
Reply With Quote

#4 Old Re: What happens when play media from InputStream? - 2007-04-10, 06:49

Join Date: Aug 2006
Posts: 307
axs
Offline
Regular Contributor
Quote:
Originally Posted by sinkers
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.
You are absolutely free to create a customized DataSource with N SourceStreams, but such solution will go through the same native player. So, if a native player is able to utilize N SourceStreams, it will, but in many cases it just loading data through the one SourceStream (aka InputStream), and limitations of the native media player (and mobile operating system's too) also will "work" here.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
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

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ