I am using VideoView in Android for displaying streaming videos. While playing the videos if a user receives & disconnects the call ,the video starts playing from beginn
You probably should look at the life of an activity. Make sure you handle the onStart() and onStop() well, starting the video in the same place.
VideoView has an getCurrentPosition() and seekTo(), those should help to get the spot set right.
Good luck!
I have not tried this, but this is where I would start:
Step #1: In onStop()
, call getCurrentPosition()
on the VideoView and save the value.
Step #2: In onStart()
, call getCurrentPosition()
on the VideoView
and compare it to the value from Step #1. If they differ (e.g., getCurrentPosition()
is now 0
), call seekTo()
, supplying the value from Step #1.
Step #3: In onSaveInstanceState()
, call getCurrentPosition()
on the VideoView
and store the value in the supplied Bundle
.
Step #4: In onRestoreInstanceState()
, obtain the value from Step #3 from the supplied Bundle
and put it in the data member used by Step #1 and Step #2.
This should cover you for the relevant scenarios that might occur while the phone call is going on.