Phreshhh / PhreshPlayer

Electron based media player app.
Other
80 stars 23 forks source link

Elevated disk usage during playback #2

Closed abdulmoizhussain closed 5 years ago

abdulmoizhussain commented 5 years ago

Reason:

The player is saving videoid & videotime on every timeupdate event (at lines: 382 & 383).

346:      videoplayer.addEventListener("timeupdate",function(e) {`
.
.
.
382:        store.set('lastplayed.videoid', currPlay);
383:        store.set('lastplayed.videotime', currTime);
384:
385:      }, false);

They can be saved on pause playback and quit player events, instead. By creating a function inside player.js file.

Example:

function setLastPlayed() {
  store.set('lastplayed.videoid', playing.getAttribute("data"));
  store.set('lastplayed.videotime', videoplayer.currentTime);
}

Usage in: index.html

Mousetrap.bind('q', function () {
      playerjs.setLastPlayed();
      currentWindow.close();
});

Usage in: handlePlayPause

case "pause";
...
setLastPlayed();
break;
default;
...
setLastPlayed();
break;
Phreshhh commented 5 years ago

Hi abdulmoizhussain!

Thanks for your contribution. Yes, i know this problem. I tried save only on quit in the 1st release, but the player faster closed then the save run.

In the next release comes with few bug fix (also this) and some futures. The release probable arrival time is 2019 Aug.

Have a nice day!

Phreshhh commented 5 years ago

Hi!

Your recomennded solution still not works on system window close (same problem when i created the v1.0.0), but i find a solution what works in all ways.

The new v.1.1.2 release is included the fix: https://github.com/Phreshhh/PhreshPlayer/releases/tag/v1.1.2

Bye

abdulmoizhussain commented 5 years ago

Hi, Thank you, for having a look at the solution. Have tried the new update of the player, in themes cobalt one is really great (Y).