Correct.
When I want to get the duration, method #2 is right. matadata may be
wrong from method #1.
When I want to get the ID tag information, method #1 is better as
Method #2 has not given out such API as Title, Aurthod, etc.

Thanks Macro.

On Jul 18, 1:23 am, Marco Nelissen <[email protected]> wrote:
> Method #1 gets the duration from the metadata in the file, which in
> practice is often wrong.
>
>
>
> On Fri, Jul 17, 2009 at 12:15 AM, Chenny<[email protected]> wrote:
>
> > Hi Friends,
>
> > When I create an APP for Media test, I'd like to get the duration of
> > tested clip. Nut as the debug result, the duration is different
> > between the 2 methods for many clips.
>
> > Method 1:
> > MediaMetadataRetriever retriever = new MediaMetadataRetriever();
> > retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY);
> > retriever.setDataSource(mCurrentAVFile);
> > int mDuration = retriever.extractMetadata
> > (MediaMetadataRetriever.METADATA_KEY_DURATION);
>
> > int mDurSecond = Integer.parseInt(mDuration);
> > mDurSecond = mDurSecond/1000;
> > int mDurHour = mDurSecond/3600;
> > mDurSecond = mDurSecond%3600;
> > int mDurMinute = mDurSecond/60;
> > mDurSecond = mDurSecond%60;
> > mDuration = mDurHour+":"+mDurMinute+":"+mDurSecond;
> > Log.i(TAG,"mDuration: "+mDuration);
>
> > Method 2:
> > private VideoView   mVideoView;
> > mVideoView.setVideoURI(mUri);
> > long mDurationTime = mVideoView.getDuration();
> > mDurationTime = mDurationTime/1000;
> > Log.i(TAG,"onPrepared Stream Duration: "+ mDurationTime+" seconds\n");
>
> > What is the reason? And I checked the result of Method 2 is right when
> > compared with PC result. Is there a bug for
> > MediaMetadataRetriever.extractMetadata
> > (MediaMetadataRetriever.METADATA_KEY_DURATION)?
>
> > Anybod can help me out?
>
> > Thanks very much.
>
> > Chenny- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to