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 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

