forked from platypush/platypush
Added video.omxplayer frontend plugin
This commit is contained in:
parent
53f8f88bac
commit
ebed6adf57
3 changed files with 71 additions and 0 deletions
9
platypush/backend/http/static/css/video.omxplayer.js
Normal file
9
platypush/backend/http/static/css/video.omxplayer.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
#video-container {
|
||||
max-width: 60em;
|
||||
margin: 3em auto;
|
||||
}
|
||||
|
||||
#video-form input[type=text] {
|
||||
width: 100%;
|
||||
}
|
||||
|
43
platypush/backend/http/static/js/video.omxplayer.js
Normal file
43
platypush/backend/http/static/js/video.omxplayer.js
Normal file
|
@ -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();
|
||||
});
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<script type="text/javascript" src="{{ url_for('static', filename='js/video.omxplayer.js') }}"></script>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/video.omxplayer.css') }}"></script>
|
||||
|
||||
<div class="row" id="video-container">
|
||||
<form action="#" id="video-form">
|
||||
<div class="eleven columns">
|
||||
<label for="resource">
|
||||
Supported formats: <tt>file://[path]</tt>, <tt>https://www.youtube.com/?v=[video_id]</tt>
|
||||
</label>
|
||||
<input type="text" name="resource" placeholder="Video URL">
|
||||
</div>
|
||||
<div class="one column">
|
||||
<button type="submit">
|
||||
<i class="fa fa-podcast"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
Loading…
Reference in a new issue