Open Yx2xY opened 1 year ago
One way you can already accomplish this is with a bit of scripting. This is what it would look like on v10:
Paste this as the Run On Apply:
setTimeout(()=> {
token.sourceElement.loop = false;
token.sourceElement.currentTime = 0;
}, 50);
Unfortunately messing with the looping behaviour of the token itself is not trivial, and would add extra overhead on Foundry when using TVA. The above is a workaround that should hopefuly work in your scenario. If more users of TVA express the need for it I might consider adding it as an inbuilt feature.
token.sourceElement.currentTime = 0;
^ If curious this is to fix the weird Foundry behaviour which is to randomize the starting time of the video when applied to the token. The above line sets the starting time to 0.
Thank you very much! I really appreciate it
Sorry to bother again, using the script I'm getting syntax errors on the console.
Maybe a bug?
do you get the same error if you paste in the following as the Run On Apply?:
console.log(token)
When used by itself or with the previous command it does not return an error, just several warnings.
and it seems it's not stopping the video from looping.
I need to sign off for now but if you provide info about your Foundry version, game system, and the version of TVA you're using I'll look into this more tomorrow.
Sure thing!
Foundry V10.288 System 5e TVA 4.3.0
Tested using those exact Foundry, system, and module versions and am unable to reproduce the error.
Your token configuration looks right to me so I'm not sure why it's throwing those errors.
At the moment I can only think of perhaps trying to remove new line characters as those might be causing some sort of parsing issue with something I didn't account for... But this is a long shot...
setTimeout(()=> {token.sourceElement.loop = false;token.sourceElement.currentTime = 0;}, 50);
Don't worry friend, its probably some weird interaction that just happens to me. A bit more information in case you want to investigate further
TVA enabled and all other modules disabled the line of script still does not work on the token that I'm assigning the animated variants (It already has several enabled).
On other tokens with static images and no other Variant art the script works, it works the first time the Active Effect is enabled, then it appears to work on and off with each activation until stops working at all.
I tried on a token with a webm and no other Active Effect or Variant configured and same behavior, works the first time then on and off until it stops
Tried in another token with a webm and an Active Combat Variant and the script works, same behavior from previous two iterations.
After deleting the Variant Token Active Effect on every token and enabling it again on the original one, and doing a server reset I ended up with the same behavior of working for a bit from previous iterations with the other tokens.
On the player side the script works a lot more consistently. Even with modules enabled and on the "original" token
When both player and GM connected, if the DM activates the status effect both see the webm looping, but if the player is the one who enables the active effect the loop only happens on the GM screen
All of this testing was done on with the same webm that incurred in the issue in the first place, I'll keep testing with the remaining tokens that I want to enable Variant art for Active Effects
Also noticed while writing these findings and testing scenarios that if I spend an amount of time on another tab the script stops working, but I'm sure that is something on foundry's side and out of control
In conclusion it appears that the script stops working all together after several activations on the GM side and less so on the player side, and it seems that a server reset like the ones that happen when enabling or disabling modules fixes the issue for a while for the GM and then we're back to repeating the previous cycle.
First of all, thank you for this amazing module. It really gives a new dimension to my games.
I wanted to know if it would be possible to have an option to stop webm's used as variant token image from looping. I'm experimenting with status effect using webm's as variant tokens for instances like "death" Active Effect and the video keeps looping with no apparent way to stop it from doing so outside of configuring it as an Overlay.
Sorry for my poor formatting, English is not my first language, if you need additional information let me know.
Thanks for all your hard work!