Open TakeFiveGames opened 2 years ago
I think there are a few fields that are missing from here: https://github.com/kibook/pmms/blob/fc6b0fdcf38c2c84fe05fc27ada3089236ae96a3/server.lua#L386-L393
Adding
dmp.loop = defaultMediaPlayer.loop
will probably fix this, but I will have to test that and check what else should be added here.
I think there are a few fields that are missing from here:
https://github.com/kibook/pmms/blob/fc6b0fdcf38c2c84fe05fc27ada3089236ae96a3/server.lua#L386-L393
Adding
dmp.loop = defaultMediaPlayer.loop
will probably fix this, but I will have to test that and check what else should be added here.
Appreciate the response! It's great to see someone offer a free resource and provide support for it as well. I've been so tied up trying to fix the paid stuff that I haven't had time to dive into learning how PMMS works yet to work on it myself lol. Either way, it's an amazing resource. Much thanks.
I'll add that on my end as well and see if it fixes our video loop issue.
I think I see what is happening now;
syncMediaPlayers() is returning 'nil' for default media players specified in the Config.lua, which means the "resetPlaytime(handle)" check is never being executed, thus the video won't restart. If I can figure out how to get the duration of a video from the HTTPS request, then I can fix this and submit a PR, but Javascript/HTTP Requests are not what I'm strong with.
Setting duration = 90,
manually in the config fixes the looping issue. So it would appear the issue is that videos that are specified in the config.lua are not detecting how long their duration is supposed to be so that the sync loop on server.lua:275 knows to loop the video.
I don't know how to write HTTP requests to check the duration time of a video, so I can't fix this for a pull request.
To confirm, specifying the duration in the config for the default media player solves this bug.
I didn't have a chance to test this myself yet, but you're right, looping will not work properly on a video started server-side (through commands or configuration files) without setting a duration manually.
Currently, the server doesn't make any kind of requests to the sites where a video is being played from, that is all handled client-side through MediaElement.js, which abstracts the different processes you'd need to fetch the duration from various supported video sharing sites into a simple media.duration
property. Fetching the information server-side would also present another problem in that VPSs are often blocked from APIs due to the amount of bot traffic coming from their networks.
I think there is a client-side solution, though, one that would also fix issues with some other sites like Vimeo that technically should work with pmms but have problems because the video duration is initially reported as 0
or null
and only some time after the video starts playing is properly reported. One option would be to have clients report the duration to the server when it changes so it has the proper length of the video. That should work here, too, because the empty duration would be filled in once the video starts playing.
Another option would be to discard storing the duration server-side completely. I've actually implemented this in an experimental pmms-web repository, which is aiming to create a "universal" version of pmms that will work across multiple games with web-browser TVs, like FiveM and SecondLife, as well as just regular web browsers.
But for now, you'll just have to set the duration in config.lua.
When settting the "loop" variable to true in the config.lua, the video does not loop. When you open the menu via
/pmms
, after selecting the correct scaleform in the drop down the settings show the loop box to be unchecked.[Later Update] This appears to be becasue of
server.lua:275
, syncMediaPlayers() When you define a media player in theconfig.lua
,info.duration
is nil, resulting inresetPlayetime()
never being called, AKA the video just plays forever and never repeats. This works for live events but not looped non-live streams.