]> git.sesse.net Git - vlc/blob - share/lua/http/js/ui.js
luaHTTP: behave like oldHTTP for seeking
[vlc] / share / lua / http / js / ui.js
1 $(function(){
2         $( "#seekSlider" ).slider({
3                 range: "min",
4                 value: 0,
5                 min: 0,
6                 max: 100,
7                 stop: function( event, ui ) {
8                         $( "#currentTime" ).empty().append( format_time(Math.round((ui.value/100)*$('#seekSlider').attr('totalLength'))) );
9                         switch(current_que){
10                                 case 'main':
11                                         sendCommand({'command':'seek','val':(ui.value)+'%'});
12                                         break;
13                                 case 'stream':
14                                         sendVLMCmd('control Current seek '+ui.value);
15                                         break;
16                         }
17                 }
18         });
19         $( "#volumeSlider" ).slider({
20                 range: "min",
21                 value: 50,
22                 min: 0,
23                 max: 100,
24                 stop: function( event, ui ) {
25                         $( "#currentVolume" ).empty().append( ui.value+"%" );
26                         sendCommand({
27                                 'command':'volume',
28                                 'val':Math.round(ui.value*5.12)
29                         })
30                 }
31         });
32         $('#buttonStop').click(function(){
33                 switch(current_que){
34                         case 'main':
35                                 sendCommand({'command' : 'pl_stop'})
36                                 break;
37                         case 'stream':
38                                 sendVLMCmd('control Current stop');
39                                 break;
40                 }
41                 return false;
42         });
43         $('#buttonPlay').click(function(){
44                 if($(this).attr('state')=='stopped'){
45                         switch(current_que){
46                                 case 'main':
47                                         var id  =       $('.jstree-clicked','#libraryTree').length>0 ?  $('.jstree-clicked','#libraryTree').first().parents().first().attr('id').substr(5) : current_id;
48                                         sendCommand({'command':'pl_play','id':id});
49                                         break;
50                                 case 'stream':
51                                         sendVLMCmd('control Current play');
52                                         flowplayer("player", "http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf");
53                                         break;
54                         }
55                 }else{
56                         switch(current_que){
57                                 case 'main':
58                                         sendCommand({'command':'pl_pause'});
59                                         break;
60                                 case 'stream':
61                                         sendVLMCmd('control Current pause');
62                                         break;
63                         }
64                 }
65                 return false;
66         });
67         $('#buttonFull').click(function(){
68                 sendCommand({'command':'fullscreen'});
69                 return false;
70         });
71         $('#stream_host').val(stream_server);
72 })