Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1.1.0 - VPaid and no duration (-1) #526

Closed
cmellinas opened this issue Feb 21, 2018 · 2 comments
Closed

V1.1.0 - VPaid and no duration (-1) #526

cmellinas opened this issue Feb 21, 2018 · 2 comments
Assignees
Labels

Comments

@cmellinas
Copy link
Contributor

Hi,

Since the new version of this plugin, you changed the calculation of Ad duration and remaining time

Here you can find before VS now (I simplified and removed functions)
In bold(V1.1.0), the changing line

V0.8:

      var remainingTime = this.adsManager.getRemainingTime();
      var duration =  this.currentAd.getDuration();
      var currentTime = duration - remainingTime;
      currentTime = currentTime > 0 ? currentTime : 0;

      var remainingMinutes = Math.floor(remainingTime / 60);
      var remainingSeconds = Math.floor(remainingTime % 60);
      if (remainingSeconds.toString().length < 2) {
        remainingSeconds = '0' + remainingSeconds;
      }

V1.1.0:

  var remainingTime = this.adsManager.getRemainingTime();
  var duration = this.currentAd.getDuration();
  var currentTime = duration - remainingTime;
  currentTime = currentTime > 0 ? currentTime : 0;

  **var remainingTime = duration - currentTime;** // We override the first remainingTime here

  var remainingMinutes = Math.floor(remainingTime / 60);
  var remainingSeconds = Math.floor(remainingTime % 60);
  if (remainingSeconds.toString().length < 2) {
    remainingSeconds = '0' + remainingSeconds;
  }

As we use VPaid, sometimes there are strange cases where:
this.currentAd.getDuration() returns -1
this.adsManager.getRemainingTime() return 15 seconds for example (this method seems to be more stable, and return a value in more cases than the other)

As we don't use it anymore to calculate the remaining time, we have sometimes VPaid with -1;-1 values which were not the case in 0.8

Any reasons the two methods return different results?

Thanks

@shawnbuso
Copy link
Contributor

Hey there - sorry I sent out a PR but forgot to respond here. I'm changing the plugin to avoid re-calculating the remainingTime, so this should fix your issue.

@shawnbuso
Copy link
Contributor

This fix is now available in 1.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants