Skip to content
Snippets Groups Projects
Commit 92db0354 authored by Ondřej Trojan's avatar Ondřej Trojan
Browse files

fixed playback

parent 0e838a99
No related branches found
No related tags found
No related merge requests found
......@@ -58,9 +58,6 @@ public class ApplicationSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/api/**", "/control", "/admin").hasRole(ADMIN.name())
.anyRequest()
.authenticated();
//.and()
//.exceptionHandling().accessDeniedPage("/error");
}
......
......@@ -5,7 +5,7 @@ var shutdown1Btn = document.getElementById('shutdown1');
var shutdown2Btn = document.getElementById('shutdown2');
var serverUrl = window.location.host;
var serverUrl = 'http://' + window.location.host;
var apiVlcPrefix = '/api/vlc';
function getCookie(name) {
......@@ -43,39 +43,38 @@ const sendHttpRequest = (method, url, data) => {
}
function controlAdd () {
sendHttpRequest('POST', serverUrl + apiVlcPrefix+'/add', {
function controlAdd() {
sendHttpRequest('POST', serverUrl + apiVlcPrefix + '/add', {
video: '1.mp4'
}).then(responseData =>{
}).then(responseData => {
handeResponseAlert(responseData);
}).catch(err => {
})
}
function controlPlay () {
sendHttpRequest('POST', serverUrl + apiVlcPrefix+'/play').then(responseData =>{
function controlPlay() {
sendHttpRequest('POST', serverUrl + apiVlcPrefix + '/play').then(responseData => {
handeResponseAlert(responseData);
}).catch(err => {
})
}
function controlPause() {
sendHttpRequest('POST', serverUrl + apiVlcPrefix+'/pause').then(responseData =>{
sendHttpRequest('POST', serverUrl + apiVlcPrefix + '/pause').then(responseData => {
handeResponseAlert(responseData);
}).catch(err => {
})
}
function controlShutdown(btn,client) {
sendHttpRequest('POST', serverUrl + apiVlcPrefix+'/shutdown/?clientId='+client)
.then(responseData =>{
function controlShutdown(btn, client) {
sendHttpRequest('POST', serverUrl + apiVlcPrefix + '/shutdown/?clientId=' + client)
.then(responseData => {
handeResponseAlert(responseData);
}).catch(err => {
})
}
function handeResponseAlert(text){
function handeResponseAlert(text) {
console.log(text);
// alertMessageBox.insertAdjacentHTML('beforeend', '<div class="alert alert-success" role="alert">'+text+'</div>');
}
......@@ -84,5 +83,9 @@ function handeResponseAlert(text){
playBtn.addEventListener('click', controlPlay)
pauseBtn.addEventListener('click', controlPause)
addBtn.addEventListener('click', controlAdd)
shutdown1Btn.addEventListener('click', () => { controlShutdown(shutdown1Btn,1); })
shutdown2Btn.addEventListener('click', () => { controlShutdown(shutdown1Btn,2); })
shutdown1Btn.addEventListener('click', () => {
controlShutdown(shutdown1Btn, 1);
})
shutdown2Btn.addEventListener('click', () => {
controlShutdown(shutdown1Btn, 2);
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment