platypush/platypush/backend/http/static/js/video.omxplayer.js

44 lines
1.0 KiB
JavaScript
Raw Normal View History

2018-04-24 01:03:50 +02:00
$(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();
});