2018-04-24 01:03:50 +02:00
|
|
|
$(document).ready(function() {
|
|
|
|
var $container = $('#video-container'),
|
2018-04-24 01:23:06 +02:00
|
|
|
$searchForm = $('#video-search'),
|
|
|
|
$ctrlForm = $('#video-ctrl');
|
2018-04-24 01:03:50 +02:00
|
|
|
|
|
|
|
var initBindings = function() {
|
2018-04-24 01:23:06 +02:00
|
|
|
$searchForm.on('submit', function(event) {
|
2018-04-24 01:03:50 +02:00
|
|
|
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;
|
|
|
|
});
|
2018-04-24 01:23:06 +02:00
|
|
|
|
|
|
|
$searchForm.find('button[data-action]').on('click', function(evt) {
|
|
|
|
var action = $(this).data('action');
|
|
|
|
var $btn = $(this);
|
|
|
|
|
|
|
|
execute(
|
|
|
|
{
|
|
|
|
type: 'request',
|
|
|
|
action: 'video.omxplayer.' + action,
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
2018-04-24 01:03:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
var init = function() {
|
|
|
|
initBindings();
|
|
|
|
};
|
|
|
|
|
|
|
|
init();
|
|
|
|
});
|
|
|
|
|