samlich / peertube-plugin-web-monetization

Apache License 2.0
13 stars 3 forks source link

Video blocked although payment rate is met #2

Closed vingle closed 2 years ago

vingle commented 2 years ago

Firstly thanks so much for making this integration. It seems really nice - and works as expected - I can add monetisation tags, it receives payments, shows stats. However, the minimum pay rate seems to be maybe clashing against inconsistent streams from the Coil plugin.. or something else, as I keep getting the error when viewing with a Coil plugin:

Viewing this video requires a higher pay rate
You have paid £0.05137534/10m. This video requires £0.03/10m.

The amount also suggests I am paying enough - and the view rate is lower than Coil's $0.36/hr. But if I try after a few minutes of waiting it works.

samlich commented 2 years ago

I think the issue is the paywall is triggered by xrpPaid < xrpRequired || xrpPaidSession < xrpRequiredSession. The dialog only shows the payment rate for the session, while the condition triggers also for low payment rate across all sessions. This could happen if the video is viewed without monetization before the paywall is added. There is a grace period to account for the startup time of Coil, as you mentioned. It could also be if the page is refreshed several times before the payments start, that the accrued time triggers this.

I changed it to &&, so it should work now (after updating the plugin). It should still pay the correct amount, even if the video has been viewed before at a lower payment rate, as payments are only stopped once a sufficient rate is met.

vingle commented 2 years ago

Thanks so much for that @samlich – I guess the PeerTube plugin directory takes a bit of time to update as it's still showing 1.0.4