Skip to content Skip to sidebar Skip to footer

Save Last Position Of Videoview Saved By Sharedprefrence And Start In Last Position (android Studio)

save last position of videoView saved by sharedprefrence and start in last position (android studio) hello I serch for my problam in stackaverflow and other refrences but I dont ge

Solution 1:

private int time = 0;

private ScheduledExecutorService mScheduledExecutorService;
    Runnable getPositionVideo = () -> {
        time = binding.epVideoView.getCurrentPosition();
        Log.d(TAG, ": " + time);
    };


     binding.epVideoView.setOnPreparedListener(mediaPlayer -> {
            mediaController.setAnchorView(binding.epVideoView);
            binding.epVideoView.start();
            mScheduledExecutorService = new ScheduledThreadPoolExecutor(1);
            mScheduledExecutorService.scheduleWithFixedDelay(() -> {
                runOnUiThread(getPositionVideo);
                MediaControllerCustom.init(url, time);
            }, 1000, 1000, TimeUnit.MILLISECONDS);
        });

Post a Comment for "Save Last Position Of Videoview Saved By Sharedprefrence And Start In Last Position (android Studio)"