From ebed6adf57d3b383f0f4cc6bf0507eec1d107002 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 24 Apr 2018 01:03:50 +0200 Subject: [PATCH] Added video.omxplayer frontend plugin --- .../http/static/css/video.omxplayer.js | 9 ++++ .../backend/http/static/js/video.omxplayer.js | 43 +++++++++++++++++++ .../templates/plugins/video.omxplayer.html | 19 ++++++++ 3 files changed, 71 insertions(+) create mode 100644 platypush/backend/http/static/css/video.omxplayer.js create mode 100644 platypush/backend/http/static/js/video.omxplayer.js create mode 100644 platypush/backend/http/templates/plugins/video.omxplayer.html diff --git a/platypush/backend/http/static/css/video.omxplayer.js b/platypush/backend/http/static/css/video.omxplayer.js new file mode 100644 index 00000000..694bc0c3 --- /dev/null +++ b/platypush/backend/http/static/css/video.omxplayer.js @@ -0,0 +1,9 @@ +#video-container { + max-width: 60em; + margin: 3em auto; +} + + #video-form input[type=text] { + width: 100%; + } + diff --git a/platypush/backend/http/static/js/video.omxplayer.js b/platypush/backend/http/static/js/video.omxplayer.js new file mode 100644 index 00000000..eeb7b674 --- /dev/null +++ b/platypush/backend/http/static/js/video.omxplayer.js @@ -0,0 +1,43 @@ +$(document).ready(function() { + var $container = $('#video-container'), + $form = $('#video-form'); + + var initBindings = function() { + $form.on('submit', function(event) { + var formData = $(this).serializeArray().reduce(function(obj, item) { + var value = item.value.trim(); + if (value.length > 0) { + obj[item.name] = item.value; + } + + return obj; + }, {}); + + execute( + { + type: 'request', + action: 'video.omxplayer.stop', + }, + + function() { + execute( + { + type: 'request', + action: 'video.omxplayer.play', + args: formData, + } + ) + } + ); + + return false; + }); + }; + + var init = function() { + initBindings(); + }; + + init(); +}); + diff --git a/platypush/backend/http/templates/plugins/video.omxplayer.html b/platypush/backend/http/templates/plugins/video.omxplayer.html new file mode 100644 index 00000000..32dae582 --- /dev/null +++ b/platypush/backend/http/templates/plugins/video.omxplayer.html @@ -0,0 +1,19 @@ + + + +
+
+
+ + +
+
+ +
+
+
+