Handins


We will publish here our handins for our Mobile Application course.


Media Player


We built up our media player you can download on the link below.

MediaPlayer.apk

The features are the following ones :

- read a video from an url
- move into the video with a seekBar
- the seekBar shows the progress of the video
- play and pause an embedded music



We had some issues to update the progress bar while the video was playing. The problem was that the video wasn't loaded yet when we started the thread which updates the progress. The source of this problem was the call of getDuration() on the videoView instance which returned -1. And to set the value of the progress,  we did : getCurrentProgress() * 100 / getDuration(), so of course it couldn't work. We had to use an onPrepareListener(). This method is called once the video is loaded in the videoView, so when the call is made, we can get the correct value for the video's duration and make the seekBar progress working well.

We also encountered difficulties to seek the video to the wanted position. The video was looping from the beginning because the thread which updates the progress of the seek bar caused a call to the event onProgressChanged() attached to the seek bar and this method calls seekTo so the video was sought to the previous position each time the progress bar was updated. To avoid this issue, we finally used the onStopTrackingTouch method which is called only when there is an action made by the user. With this code, the progress thread doesn't interact with the OnSeekBarChangeListener anymore.

Even though we had never developed on Android, this project was quite easy because we are used to make program in Java for 2 years  and the documentation is well written!

-> Original past here!


 
;