John-Marc,

I have not done this myself, but here is tutorial on how to do it:
http://blog.pocketjourney.com/2008/04/04/tutorial-custom-media-streaming-for-androids-mediaplayer/

They actually create new MediaPlayer object upon every update to the
buffer file and point this new MediaPlayer to the updated buffer every
single time.

I would test calling MediaPlayer.reset() first instead of creating new
player object every time, to see whether time and memory consumed by
such solution is a bit better.

HTH,

Daniel





On 30 January 2012 15:49, John-Marc Desmarais <[email protected]> wrote:
> Hi,
>
> I am currently writing a video file to the SDCard while playing it
> with VideoView.
>
> My problem is that, if I buffer 1MB of video and begin the Video
> playback, the video stops after 1MB has been played, even though by
> this time, 5MBs of file has now been written to the sdcard.
>
> I have been trying various things in onCompletion handler.. such as:
>                int curLoc = mp.getCurrentPosition();
>                Log.e(LogName.onCompletion, LogName.onCompletion + 
> "CurrentLocation:
> " + mp.getCurrentPosition());
>                Log.e(LogName.onCompletion, LogName.onCompletion + "Duration: 
> " +
> mp.getDuration());
>                mp.pause();
>                mp.prepareAsync();
>                mp.start();
>                mp.seekTo(curLoc);
>
> In this case I get a "Cannot play video" message.
>
> Or:
>                int curLoc = mp.getCurrentPosition();
>                Log.e(LogName.onCompletion, LogName.onCompletion + 
> "CurrentLocation:
> " + mp.getCurrentPosition());
>                Log.e(LogName.onCompletion, LogName.onCompletion + "Duration: 
> " +
> mp.getDuration());
>                mp.prepareAsync();
>                mp.start();
>                mp.seekTo(curLoc);
>
> This crashes with "prepare Async in State 128".
>
> Has anyone solved the problem of re-queuing file in the videoView so
> that it plays everything that has been written to the sdcard even
> though it starts with a smaller file?
>
> Regards,
> -jm
>
> --
> 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



-- 
Daniel Drozdzewski

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