Yoooi0 / MultiFunPlayer

flexible application to synchronize various devices with media playback
https://yoooi0.github.io/MultiFunPlayer/
MIT License
105 stars 20 forks source link

Add ability to send current time of script along with axis data in TCP/UDP #128

Closed RFClimb closed 1 year ago

RFClimb commented 1 year ago

In order to ease using the TCP output for custom devices, I would like the possibility to include the current script time in the output, not just the "Tick elapsed time" (Which seems to always be 33 or 34 in my case).

I would suggest the format be whole number of milliseconds into the script. If constant length is desired, then zero-padding the output could be a solution. Assuming a maximum of 24 hours should be safe - meaning 8 digits is sufficient (86400000 milliseconds in a day).

Yoooi0 commented 1 year ago

Outputs are completely decoupled from script code and they don't know its time/duration/play state etc. so there is no clean way to add that now. Maybe you could make a plugin that sends video events to your device if you need that. But why would a device need the current script/video time?

"Tick elapsed time" (Which seems to always be 33 or 34 in my case).

Your update rate is probably 30hz. Or its the fastest it can run given network delays.

RFClimb commented 1 year ago

A plugin might be a good solution.

Is documentation or an example of how to make plugins available? I am unable to find anything, except it should be C#.

Yoooi0 commented 1 year ago

No documentation yet. You can use the plugin base class as an "api": https://github.com/Yoooi0/MultiFunPlayer/blob/master/Source/MultiFunPlayer/Plugin/PluginBase.cs

Example plugin:

using MultiFunPlayer.Plugin;
using MultiFunPlayer.Common;
using System;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Linq;

namespace Demo;

public class Plugin : AsyncPluginBase
{
    public Plugin()
    {
        //initialize
    }

    protected override void HandleMessage(MediaPositionChangedMessage message)
    {
        //send
    }

    protected override void Dispose(bool disposing)
    {
        //cleanup
    }
}

Save as Plugin.cs into Plugins folder.

Yoooi0 commented 1 year ago

Closing this for now, comment here if you need help with the plugin.