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

Execute/fetch without loading animation #15

Open
slonopot opened this issue Oct 10, 2024 · 3 comments
Open

Execute/fetch without loading animation #15

slonopot opened this issue Oct 10, 2024 · 3 comments

Comments

@slonopot
Copy link

I'd like to track the progress on the server by periodically sending current position from the player. The problem is that any action that takes an URL (apart from background) shows a loading popup and an error in case of a timeout. I could use background:{URL}, but it does not replace any parameters (like {ID}). Is there any way to make execute:{URL} or any of its forms quiet?

I have considered doing this from the player itself and not by setting a million of external triggers (there's no recurring one, maybe we need it), but my challenge is to leave the player as-is and do the job by using an universal setup.

Thanks!

@benzac-de
Copy link
Owner

Thank you for this request.

For a recurring trigger, you can use the trigger {TICKS}t in combination with the action player:ticking:restart. Please see the following example.

{
   "type": "pages",
   "headline": "Videos",
   "template": {
      "tag": "Web",
      "type": "separate",
      "layout": "0,0,2,4",
      "icon": "msx-white-soft:movie",
      "color": "msx-glass",
      "properties": {
         "trigger:0t": "[player:ticking:restart|execute:service:video:data:accurate:http://msx.benzac.de/services/nop.php]"
      }
   },
   "items": [
      {
         "title": "Video 1",
         "playerLabel": "Video 1",
         "action": "video:http://msx.benzac.de/media/video1.mp4"
      },
      {
         "title": "Video 2",
         "playerLabel": "Video 2",
         "action": "video:http://msx.benzac.de/media/video2.mp4"
      },
      {
         "title": "Video 3",
         "playerLabel": "Video 3",
         "action": "video:http://msx.benzac.de/media/video3.mp4"
      }
   ]
}

In this example, the video data (including state, position, duration, speed, and an ended flag) is sent to a server every second. For the server used in this example, I do not see any loading circles (they appear after 1 second) or timeout errors (they appear after 30 seconds) at my location. Loading circles or timeout errors cannot currently be suppressed and I do not know if it would be a good idea to provide such kind of function.

If you have a server where such errors can occur, you may want to consider using an interaction plugin. With an interaction plugin, you can periodically fetch the video data and send it to your server and suppressing any errors or timeouts (or adding additional logic). Please see the following example.

var sendVideoDataDelay = new TVXDelay(1000); //1s delay
var sendVideoData = function () {
    TVXInteractionPlugin.requestData("video:data", function (data) {
        TVXServices.ajax.post("http://msx.benzac.de/services/nop.php", TVXTools.serialize(data.video));
        sendVideoDataDelay.restart();
    });
}
sendVideoDataDelay.start(sendVideoData);

Best regards,
benzac

@benzac-de benzac-de reopened this Oct 10, 2024
@benzac-de
Copy link
Owner

After some thoughts, I decided to implement a silent mode for execute actions, because it could be useful in different cases.
By setting a silent: prefix, the silent mode is used for these requests and no busy indicator and error messages are displayed (i.e. the error messages are only output in the log). This function can be used from version 0.1.160.

For the example above, the request would look like this: [player:ticking:restart|execute:service:video:data:silent:accurate:http://msx.benzac.de/services/nop.php]

All possible positions of the silent: prefix can be found in the wiki or on the actions page.

Best regards,
benzac

@slonopot
Copy link
Author

Perfect, thank you for this feature.

I have plans to test the interaction plugin approach you suggested earlier. I'll report here when it's done and if I have achieved my goals

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

No branches or pull requests

2 participants