Code example for MediaPlayer

Methods: getDurationpreparereleasesetDataSource

0
        } 
    } 
 
    public void validateRecordedVideo(String recordedFile) {
        try { 
            MediaPlayer mp = new MediaPlayer();
            mp.setDataSource(recordedFile);
            mp.prepare();
            int duration = mp.getDuration();
            if (duration <= 0){
                fail("stressRecordAndPlayback");
            } 
            mp.release();
        } catch (Exception e) {
            fail("stressRecordAndPlayback");
        } 
    } 
 
    public void removeRecordedVideo(String fileName){
        File video = new File(fileName);
        Log.v(TAG, "remove recorded video " + fileName);