Repository navigation
Expand file tree
/
Copy pathVLC.js
More file actions
100 lines (77 loc) · 2.05 KB
/
Copy pathVLC.js
File metadata and controls
100 lines (77 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
function updateData() { //a mettre dans dataEvent ? fonction qui s'execute des qu'on recoit un retour sur une autre commande
local.sendGET("requests/status.xml");
}
function dataEvent(data, requestURL)
{
for(i = 0; i < data.split(">").length; i++) {
if(data.split(">")[i].split("<")[1] == "/fullscreen") {
local.values.fullscreen.set(data.split(">")[i].split("<")[0]);
}
if(data.split(">")[i].split("<")[1] == "/time") {
local.values.time.set(data.split(">")[i].split("<")[0]);
}
if(data.split(">")[i].split("<")[1] == "/length") {
local.values.length.set(data.split(">")[i].split("<")[0]);
}
if(data.split(">")[i].split("<")[1] == "/volume") {
local.values.volume.set(data.split(">")[i].split("<")[0]);
}
if(data.split(">")[i].split("<")[1] == "/loop") {
if(data.split(">")[i].split("<")[0] == "true") { local.values.loop.set("true"); }
else { local.values.loop.set("false"); }
}
if(data.split(">")[i].split("<")[1] == "/repeat") {
if(data.split(">")[i].split("<")[0] == "true") { local.values.loop.set("repeat"); }
}
if(data.split(">")[i].split("<")[1] == "info name='filename'") {
local.values.videoName.set(data.split(">")[i+1].split("<")[0]);
}
if(data.split(">")[i].split("<")[1] == "/state") {
local.values.state.set(data.split(">")[i].split("<")[0]);
}
}
}
function play()
{
sendCommand("pl_play");
}
function pause()
{
sendCommand("pl_pause");
}
function stop()
{
sendCommand("pl_stop");
}
function playFile(file)
{
file = "file:///"+file;
var f = file.replace(":","%3A").replace("/","%2D").replace(" ","%20");
sendCommand("in_play&input="+file);
}
function previous()
{
sendCommand("pl_previous");
}
function next()
{
sendCommand("pl_next");
}
function toggleLoop()
{
sendCommand("pl_loop");
}
function toogleFullscreen() {
sendCommand("fullscreen");
}
function seekTo(value) {
sendCommand("seek&val="+value);
}
function setVolume(value)
{
sendCommand("volume&val="+parseInt(value*255));
}
function sendCommand(command)
{
local.sendGET("requests/status.xml?command="+command);
}