Hallo zusammen
Hab mich mal wieder daran gemacht mein IPS-MediaCenter zu vervollständigen.
Habe es geschafft nun auch den VLC Player (meines erachtens der Beste Video Player) per PHP/IPS Script anzusteuern.
Dazu müsst Ihr nur in den Einstellungen des Players das „HTTP“ Interface aktivieren. Dann kann man sogar andere VLC-PCs fernsteuern - zum Beispiel den MediaPC im Wohnzimmer ^^
Wer daran interesse hat:
Das ganze ist eine Klasse geworden, die man einfach mittels „require_once(‚vlcPlayer.php‘)“ einbindet. Habs noch nicht geschafft das gründlich durchzutesten, aber bei mir funzt es soweit
// Include Class
require_once('vlcPlayer.php');
// Erstelle Instanz:
$VLC=new vlcPlayer();
// Datei hinzufügen und abspielen
$VLC->add("C:/Musik/a.avi",true);
// das war's schon für einen einfachen Befehl. wer zusätzlich noch den Status braucht geht weiter vor:
// Playlist aktuallisieren, das ist nötig nach jedem Befehl
// der die Playlist ändert ("add", "next", "previous", "clear_playlist" ... )
// - natürlich nur wenn man die Infos braucht
$VLC->refresh_playlist();
// Alle Informationen des VLC Object anzeigen
echo "<pre>";
print_r($vlc);
echo "</pre>";
EIGENSCHAFTEN und BEFEHLE der KLASSE:
/****************************************
* Eigenschaften des VLC Player Objekts: *
****************************************/
$VLC->requestUrl // URL to the VLC Server; You can Use an Remote Adress to steer for example your MediaPC
$VLC->serverTimeout // Timeout in Seconds, can be small if on same machine
$VLC->found_interface // Shows "false" if VLC was unreachable, and "true" if command/refresh was successfull
$VLC->volume // Volume 256 => 100% ; 512 => 200% ; 768 => 300% ; 1024 => 400%
$VLC->length // Length in Seconds
$VLC->time // Current Position in Seconds
$VLC->position // Current Position in Percent
$VLC->state // "paused" ; "playing" ; "stop"
$VLC->random // Random Mode?
$VLC->loop // Loop Mode?
$VLC->repeat // Repeat Mode?
$VLC->playlist // Playlist (use "print_r(...);" to see how it is constructed
$VLC->current // Current Item in Playlist
$VLC->playlist_length // Length of Playlist
$VLC->rawData=array(); // Contains all Status Data from the VLC Server
/****************************************
* Methoden des VLC Player Objekts: *
****************************************/
// Refresh Data ($withPlaylist)
$VLC->refresh($withPlaylist=true)
// Refresh only the Playlist Data
$VLC->refresh_playlist()
// add <mrl> to playlist [ and start playback ($play=true) ]
// What's a MRL? can be just a file from your harddisk or such much more -> http://wiki.videolan.org/Media_resource_locator
$VLC->add($mrl,$play=false)
// play playlist item <id>:
// if id = false, it tries to play the last file played.
$VLC->play($id=false)
// toggle pause. If current state was 'stop', play item <id>:
// if id = false, it tries to play the last file played.
$VLC->toggle_pause($id=false)
// stop playback:
$VLC->stop()
// jump to next item:
$VLC->next()
// jump to previous item:
$VLC->previous()
// delete item <id> from playlist:
$VLC->delete($id)
// empty playlist:
$VLC->clear_playlist()
/* sort playlist using sort mode <val> and order <id>:
If id=0 then items will be sorted in normal order, if id=1 they will be
sorted in reverse order
A non exhaustive list of sort modes:
0 Id
1 Name
3 Author
5 Random
7 Track number
*/
$VLC->sort($id,$val)
// toggle random playback:
$VLC->toggle_random()
// toggle enable service discovery module <val>:
/*
Typical values are:
sap
shoutcast
podcast
hal
*/
$VLC->toggle_enable_service($val)
// toggle fullscreen:
$VLC->toggle_fullscreen()
// set volume level to <val> (can be absolute integer, percent or +/- relative value):
/*
Allowed values are of the form:
+<int>, -<int>, <int> or <int>%
*/
$VLC->volume($val)
// seek to <val>:
/*
Allowed values are of the form:
[+ or -][<int><H or h>:][<int><M or m or '>:][<int><nothing or S or s or ">]
or [+ or -]<int>%
(value between [ ] are optional, value between < > are mandatory)
examples:
1000 -> seek to the 1000th second
+1H:2M -> seek 1 hour and 2 minutes forward
-10% -> seek 10% back
*/
$VLC->seek($val)
Viel Spass damit
Huelke
vlcPlayerClass.rar (4.4 KB)