How to setup multi-user streaming server, web interfaced?

Microsoft Windows specific usage questions
Forum rules
Please post only Windows specific questions in this forum category. If you don't know where to post, please read the different forums' rules. Thanks.
JamesGuthrie
New Cone
New Cone
Posts: 8
Joined: 14 Oct 2009 23:25

How to setup multi-user streaming server, web interfaced?

Postby JamesGuthrie » 14 Oct 2009 23:48

Note, the original post (italicised) is now a little redundant, as I've put together a package for download which has the necessary php code to provide a browsing structure to completely automate the provision of video streams with VLC/VLM. The most updated/important parts of this post are now bolded, please only pay attention to the bolded text.

Hi all,

I've done a fair amount of looking through the forums/wiki/docs and I'm having absolutely no luck trying to find info on how to set up what I'm trying to set up. In order to get an idea for where my logic is going wrong, I'll first outlay exactly what I want and how I expect one would do that. I would like some feedback on my thought processes here.

What I want:

A web-interfaced video streaming service with the following functionality:
The web interface provides fully functional folder-browsing to search for a video file on the server, which should be streamed to the user. The user can then select this video, hit the "play/stream" button, and then watch the stream right then and there with the option to pause/play and potentially track the video file (I understand this is format-dependant). The playback would either be realised by some sort of embedded video player in the web browser, or through the vlc client.

How I think it should/could be implemented:

From what I've read up until now, the best way to implement this would be to have two seperate parts to the stream provision. The first would be a php-based interface, which the user uses to browse through the available files on the server. Once the user has selected a file which they would like to play, the control shifts from the php to VLC. The php would make a shell-call to execute vlc, with the desired switches to make the file which the user has selected start to stream via the VLC server. The php would then provide a link on the page which the user could click and which would open up the VLC client and accept the stream. By this solution, the php code is acting in the place of an actual person providing a stream for a user to watch.
If more than one user were to want to stream different files at once, then this would be no issue as multiple copies of VLC could be run simultaneously as servers, streaming out files to users.

I would be implementing the setup on a local network, so any streaming would be LAN-based, which should allow relatively high throughput allowing multiple users to stream at once.

My implementation idea doesn't cover the following aspects:
- would it be possible to have a fully-functional embedded video player in the browser, so that the user wouldn't necessarily need to have the VLC client installed.
- which file/streaming format would be the best for this type of application. I understand that .avi/.mkv files can't be seeked, so for seeking support .wmv would be preferable, I'd prefer not to have to reconvert 300+GB of movie files to .wmv's.
- any functionality which VLC provides which would aide in this type of setup.
- how to close instances of the VLC server which are no longer being streamed from, without any input from the client machine

An answer/response to any part of this post would be very welcome, as I understand that I may not have fully grasped the functionality of VLC's streaming abilities.

If I can get something like this implemented with VLC then I'd be willing to try writing some sort of howto for it as from what I've seen there's not yet been any similar implementation documented.

Thanks,

James


If you're too lazy to scroll down, here's an exact copy of what's written below:
LATEST EDIT: I noticed an error in the ajax search function the other day. It seems to have cropped up whilst I was editing the code for the manual which I wrote for it, should have it fixed soon.
Ok, so here it is!

I've put together a .pdf file with instructions and a code reference to what I've done. I know that what I've put together is essentially very basic, but I assume that it will help someone somewhere.

Unfortunately I can't attach the file here, so I've uploaded it to my server, you can get it at http://www.jamesguthrie.ch/phpint/phpintfrtspguide.zip. You'll have to excuse the ungainly name, but I couldn't think of anything better at the time. The zip contains all of the sourcecode I've used, as well as one pdf file, which contains the documentation.

Simple setup is outlined in the documentation file, basically copy all files into root web directory and go to http://127.0.0.1/index.php. If you think of any recommended updates to the documentation, please send me an e-mail, my e-mail is in the coverpage of the pdf instruction manual.

James
Last edited by JamesGuthrie on 30 Oct 2009 01:33, edited 2 times in total.

VLC_help
Mega Cone Master
Mega Cone Master
Posts: 25661
Joined: 13 Sep 2006 14:16

Re: How to setup multi-user streaming server, web interfaced?

Postby VLC_help » 15 Oct 2009 14:10

I'd prefer not to have to reconvert 300+GB of movie files to .wmv's
conversion can be done on fly if you are targeting normal SD playback.
would it be possible to have a fully-functional embedded video player in the browser, so that the user wouldn't necessarily need to have the VLC client installed.
Yes. VLC's current HTTP interface should support this via Flash player.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: How to setup multi-user streaming server, web interfaced?

Postby Jean-Baptiste Kempf » 15 Oct 2009 18:27

else, look at lscube
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

JamesGuthrie
New Cone
New Cone
Posts: 8
Joined: 14 Oct 2009 23:25

Re: How to setup multi-user streaming server, web interfaced?

Postby JamesGuthrie » 17 Oct 2009 16:04

* Disclaimer * although I'm trying to help people who are trying to set up something like what I'm trying to setup, I may be unwittingly posting misinformation. I'm learning this as I go along, so watch out for updates!

Hello again,

I've found that the whole "division" in what VLC offers to be a little confusing, but I think that what I'm using now is called "VLM", although it appears to be much the same as VLC. Maybe because this is new technology it's a little badly documented/presented on the part of the VLC developers. My setup is looking something like this now:

Server-side I'm using VLC as an rtsp based VOD server, which is actually what I was looking for, without knowing exactly what it was called. Setup in Windows went very smoothly following this tutorial: http://hexwiz.co.cc/articles/media_stre ... th_vlc.php.

For anyone looking into this for the first time, and reading this thread. VOD is "Video On Demand". It implies that the stream is started or stopped when the client specifies, unlike standard VLC streams which are in a TV-style stream format.

The first thing that it required is an rtsp server, the setup of which is outlined in the above link, also pasted below:
Start the server

1. Open the Microsoft command prompt - START>>RUN>>Type in cmd and hit Enter on the keyboard.
2. Navigate to the VLC installation folder. At the prompt type in cd c:\progra~1\videolan\vlc - which is in my case - the path to the default VLC installation. Of course it's not mandatory that you be in the VLC folder but this saves you some typing later.
3. Now at the prompt again type - vlc.exe -I telnet --control telnet --telnet-password q7fmZ9s --rtsp-host 0.0.0.0:5554
Let me explain what the parameters are:
-I - Enables the VLC telnet interface.
--control - Specifies the control interface
--telnet-password - Password to access the telnet interface - for security (if you dont set this option it defaults to "admin")
--rtsp-host - IP address (of the interface) and port on the streaming server on which media is to be streamed - 0.0.0.0:5554 means listen on this host on port 5554
4. Exit the command prompt by typing exit

Verify that the VLC server is running in the background with Task Manager. It must have VLC.exe in the processes list.
The server only needs to be started once per PC startup (unless it, for some reason goes down, in which case it will need to be restarted).

Once the server is running, you need to "talk" to it via telnet. In the grand scheme of things I'm going to be using php to do this, but for the meantime we're sticking with an interface like PuTTY to configure media on the server.
Once again, you can see in the link posted above how one adds media files, but here's an excerpt from that link:
Add media to stream

1. Open Putty.exe
2. Connect to the streaming server with the following settings
a. Host - localhost
b. Port - 4212 (default port that VLC server listens for telnet connections - can be set with --telnet-port)
c. Connection Type - RAW (some versions of VLC might not work proper if you set it to Telnet)
3. When the VLC telnet console prompts you for a password - just enter the telnet password you'd set at the command prompt - q7fmZ9s
4. Now to add a movie to stream - at the telnet prompt type in
new myvod1 vod enabled input D:\path\to\movie.avi
and hit enter. You can change the myvod1 tag to anything you want since it's just a tag that users can identify your movie with. The last part however is the path to the actual movie on your hard disk. So you could even use
new a_walk_to_remember vod enabled input D:\path\to\a_walk_to_remember.avi
if you think that's more convenient.

That's all there is to it. You can add more movies using the same command and format - just make sure you have unique tags/names for each movie that you add to your list to stream.
Now that the server is setup and the media is loaded, the client also needs to watch the media, which is also outlined in the above link, excerpt here:
So how do users view it?

Well I'd recommend using the VLC client itself on the viewer's system, since a lot many media players have different implementations of the RTSP protocol. For example Windows Media player uses RTSP over RTP whereas VLC's implementation of the RTSP protocol is over TCP. So Windows Media player will not be able to play a VLC RTSP stream even though it supports the RTSP protocol.

1. Open VLC on the user's system and go to File>>Open Network Stream
2. Select the RTSP radio button and in the text box type in the IP address and port of the computer which has the VLC server running and append the tag name you specified after a slash. In our examples it would be.
192.168.1.1:5554/myvod1
or
192.168.1.1:5554/a_walk_to_remember
If you've managed to get that to work so far, then it's proven that this php-interfaced media server should be implementable. First catch. When the server is restarted, any loaded media is "lost" - I'm sure that there must be a way to create a config file for this kind of thing though, so that every time the server needs to be started the most current config file with all available media is loaded.

To close, the server-side media handling thing seems to be working, now it just needs to be interfaced with php and made a little smart. I see it working as follows:

1. A user browses through the available files/directories and then chooses a file they wish to watch (all in a web-browser).
2. The php opens the config file to see if this media file exists in the rtsp server's available media.
3. Media doesn't exist, open up a telnet session with the rtsp server, add the media. Write the added media details to the config file.
4. Media existed already, or has now been added: send the user to an rtsp://hostname/medianame address, which the local-side VLC client will be able to view (I think that's how it works).

So, that's all for now. Will post updates and some php code when I get this thing working.

Advice from the experts would be highly appreciated, questions from the curious or those who don't understand would also be welcomed.

James

JamesGuthrie
New Cone
New Cone
Posts: 8
Joined: 14 Oct 2009 23:25

Re: How to setup multi-user streaming server, web interfaced?

Postby JamesGuthrie » 19 Oct 2009 15:37

Success!

I've managed to get all of the functionality that I was hoping for! I just need to make a couple of changes to my php code, comment it nicely, and then I'll start posting up a guide with php code to set this up yourself!

James

JamesGuthrie
New Cone
New Cone
Posts: 8
Joined: 14 Oct 2009 23:25

Re: How to setup multi-user streaming server, web interfaced?

Postby JamesGuthrie » 21 Oct 2009 00:10

Ok, so here it is!

I've put together a .pdf file with instructions and a code reference to what I've done. I know that what I've put together is essentially very basic, but I assume that it will help someone somewhere.

Unfortunately I can't attach the file here, so I've uploaded it to my server, you can get it at http://www.jamesguthrie.ch/phpint/phpintfrtspguide.zip. You'll have to excuse the ungainly name, but I couldn't think of anything better at the time. The zip contains all of the sourcecode I've used, as well as one pdf file, which contains the documentation.

Simple setup is outlined in the documentation file, basically copy all files into root web directory and go to http://127.0.0.1/index.php. If you think of any recommended updates to the documentation, please send me an e-mail, my e-mail is in the coverpage of the pdf file.

James

JamesGuthrie
New Cone
New Cone
Posts: 8
Joined: 14 Oct 2009 23:25

Re: How to setup multi-user streaming server, web interfaced?

Postby JamesGuthrie » 06 Feb 2010 11:00

Hello again,

So I've managed to successfully ignore this whole project for a while. The files are still available for download, but I'm not going to be developing the windows version of it any longer.

I've moved to Ubuntu Linux, so at the moment I'm making changes to the php code to function under Linux, after which I'll put the source and maybe some documentation for that online.

I'm still available for support and responding to queries via my e-mail (in the coverpage of the documentation that is downloadable in the above post).


James

hjsauls
New Cone
New Cone
Posts: 1
Joined: 08 Feb 2010 22:53

Re: How to setup multi-user streaming server, web interfaced?

Postby hjsauls » 08 Feb 2010 22:59

wow... thanks for the easy to follow guide. Worked like a champ. Eager to see the linux version because I had a little trouble with doBrowse reading a mapped drive. Mount points will definitely make things easier.

Thank again,
HJS

yzfr1
New Cone
New Cone
Posts: 1
Joined: 25 Jun 2010 15:32

Re: How to setup multi-user streaming server, web interfaced

Postby yzfr1 » 25 Jun 2010 15:37

Been looking for something like this for ages, this is brilliant! Waiting eagerly for the linux version :)

popmedia007
New Cone
New Cone
Posts: 6
Joined: 29 Jul 2010 13:58

Re: How to setup multi-user streaming server, web interfaced

Postby popmedia007 » 01 Feb 2011 22:10

I have been looking for this too.
It is great.I cannot express how thankfull i am to "JamesGuthrie".Keep up good work man.Do you know what you have done with me?


Actually we are on a university.
My friends HDD were full and I could not share video with them untill now(windows bydefault "file n printer system" is not so secure as i need).Now they can watch video content from my PC!!Our storage problem is over for you dude.Thanks.

This thread should be sticked in this location :
"viewforum.php?f=22"

I am going to implement this as a "mini private (LAN only) streaming video site".
I will share my codes with you guys.
VoD should be as easy as adding content in HFS!!

popmedia007
New Cone
New Cone
Posts: 6
Joined: 29 Jul 2010 13:58

Re: How to setup multi-user streaming server, web interfaced

Postby popmedia007 » 02 Feb 2011 16:20

doesnot work for me.gives,

"Your request is being processed
connected to host via telnet
Checking file exists
Checking file exists
Checking file exists

Fatal error: Maximum execution time of 60 seconds exceeded in D:\Prince of Persia server\htdocs\loadfile.php on line 36"

JamesGuthrie
New Cone
New Cone
Posts: 8
Joined: 14 Oct 2009 23:25

Re: How to setup multi-user streaming server, web interfaced

Postby JamesGuthrie » 02 Feb 2011 16:57

Hi popmedia007

Unfortunately I'm not running a windows machine, and as such I can't really give you much advice about what has gone wrong, or try to replicate the error. I myself am no longer using the VLC VoD code which I wrote here, merely because I haven't had the time or inclination to get it to work on Linux, although it wouldn't be too difficult.

First, a couple of questions:
1. Does this happen for all files or only some files?
2. Do you know anything about programming, or writing php?

The problem is that the php which I have written is not able to get the response it's expecting on time, and is being stopped from executing by the server. I'm not sure if this is because the code is broken, or if it is because the code is badly-written.

If some files work and others do not then it is probably because you have a lot of media in the config file, and the communication over telnet is just taking too long to find the file. This would require a either recoding of the communication with VLM, which I won't be able to fix, or extending the time which the script is allowed to be executed on the server, which would be a bit of a dirty fix.

If it is broken for every file, and has never worked ever, then it might be because VLC has changed some small part of the communication protocol over telnet, which should be fixable.

If you can answer those questions then I can maybe figure out how to get a fix working

popmedia007
New Cone
New Cone
Posts: 6
Joined: 29 Jul 2010 13:58

Re: How to setup multi-user streaming server, web interfaced

Postby popmedia007 » 02 Feb 2011 19:58

First of all,I could tell you what i did first,
My machine is windows xp sp3,2.67GHz intel cpu,2GB ram with 1GB nvidia 8500GT gpu.
Web-browser is mozilla firefox 3.6.13,installed web server software "XAMPP 1.7.0".
xampp is located in "D:\Prince of Persia server"
VLC is installed in default installation folder.version is "1.1.4 the luggage"

I read this first to understand vod.http://hexwiz.co.cc/articles/media_stre ... th_vlc.php

I downloaded the zip archive from http://www.jamesguthrie.ch/phpint/phpintfrtspguide.zip.
Upzipped it and copied these 8 files

Code: Select all

"browse.js","browser.php","checkprocs.php","config.config2", "doBrowse.php","index.php","loadfile.php","ajax.js"
(although the config.config2 folder is needed? may be not,however i do copied it also)
and the "css" folder.And pasted all stuff on,
"D:\Prince of Persia server\htdocs"

And then had a look on pdf file you gave.I Think I should upload code of "checkprocs.php","doBrowse.php" and "loadfile.php" files(as it is necessary to mod these files)
Here is it:
checkprocs.php

Code: Select all

<?php $run ="running"; $nrun ="stopped"; set_error_handler("warning_handler", E_WARNING); function warning_handler($errno, $errstr) { //echo "warning thrown, caught. Proceed"; } function checkRTSP(){ global $run,$nrun; $fp = fsockopen("localhost", 5555, $errno, $errstr, 2); if (!$fp) {echo $nrun.",<a href=\"javascript:ajaxComm('startrtsp')>start</a>";} else{echo $run.",<a href=\"javascript:ajaxComm('stoprtsp')>stop</a>";} fclose($fp); } function startRTSP(){ shell_exec('c:\progra~1\videolan\vlc\vlc.exe -I telnet --control telnet --telnet-password rumman0679 --rtsp-host 0.0.0.0:5554 --vlm-conf "http://localhost:80/vlm.config"'); } function stopRTSP(){ shell_exec('taskkill /F /IM vlc.exe /T'); } if (isset($_GET['task']) && $_GET['task'] != "") { $task = $_GET['task']; switch($task){ case "rtsp": {checkRTSP(); break;} case "startrtsp": {startRTSP(); break;} case "stoprtsp": {stopRTSP(); break;} } } ?>
doBrowse.php

Code: Select all

<?php function parent_directory($path, $convert_backslashes = false) { // Detect backslashes if( strstr($path, '\\') ) $backslash = true; // Convert backslashes to forward slashes $path = str_replace('\\', '/', $path); // Add trailing slash if non-existent if( substr($path, strlen($path) - 1) != '/' ) $path .= '/'; // Determine parent path $path = substr($path, 0, strlen($path) - 1); $path = substr( $path, 0, strrpos($path, '/') ) . '/'; // Convert backslashes back if( !$convert_backslashes) $path = str_replace('/', '\\', $path); return $path; } function showFolderContents($path,$search=""){ if (($path =="\\")||(strpos($path,"..")!==false)){$path="";} $basepath = "E:\movies\\"; // this basepath is the highest that a user can travel in the directory structure $basepath .= $path; $dir_handle = @opendir($basepath) or die("Unable to open $path"); // Open the folder $entries = scandir($basepath); // Load files and dirs into $entries global $dirs; global $files; foreach($entries as $entry){ // separate files from dirs if (is_dir($basepath.$entry)){ $dirs[] = $entry; } else{ $files[] = $entry; } } $mustSearch = false; if (strlen($search)>0){ // check if a search string is being used $mustSearch = true; } if (count($dirs) > 0){ natcasesort($dirs); // natural sort dirs, case insensitive foreach($dirs as $dir){ if ($dir == ".."){ // if it's the parent folder if ((strlen($path)!=0)) { //check to see if we're in the "root" folder echo "<a class=\"dir\" href=?path=".urlencode(parent_directory($path)).">Directory Up</a><br/>"; } }else{ if($dir!= "."){ if ($mustSearch){ if (stripos($dir,$search) !== false){ echo "<a class=\"dir\" href=?path=".urlencode($path).urlencode($dir)."\\>".$dir.'/</a><br />'; } } else { echo "<a class=\"dir\" href=?path=".urlencode($path.$dir)."\\>".$dir.'/</a><br />'; } } } } } if (count($files) > 0){ natcasesort($files); // natural sort files, case insensitive foreach($files as $file){ $regexp = "/^.+\.((wmv)|(mkv)|(avi)|(mpg))$/"; if (preg_match($regexp,$file)){ if ($mustSearch){ if (stripos($file,$search) !== false){ echo "<a class=\"file\" href=\"loadfile.php?path=".$basepath.$file."\">".$file.'</a><br />'; } }else{ echo "<a class=\"file\" href=\"loadfile.php?path=".$basepath.$file."\">".$file.'</a><br />'; } } } } // Close closedir($dir_handle); } if (isset($_GET['path']) && $_GET['path'] != "") { $path = $_GET['path']; } else {$path="";} if (isset($_GET['search']) && $_GET['search'] != "") { $search = $_GET['search']; //echo "searching<br />"; showFolderContents($path,$search); } else {showFolderContents($path);}
and "loadfile.php" file

Code: Select all

<?php function checkConfig($path){ $cfgpath="http://localhost:80/vlm.config"; //location of the config file we're using $cfgfile = file($cfgpath); $flag=false; foreach($cfgfile as $line){ //search through file for identifying string if (strpos($line,$path)){ $flag = true; } } $name = explode("\\",$path); $name = $name[count($name)-1]; $name = substr($name,0,strlen($name)-3); $name = str_replace(" ","",$name); $name = str_replace(".","",$name); $name = str_replace("_","",$name); if (!$flag) { //if identifying string not found $fp = fsockopen("localhost",5555,$errno,$errstr); stream_set_timeout($fp,5); if (!$fp){ echo "error connecting to RTSP server"; } else{ $flag = false; echo "connected to host via telnet<br />"; do{ fwrite($fp,"rumman0679\n"); //password fwrite($fp,"new ".$name." vod enabled\n"); //add vod with generated name fwrite($fp,"setup ".$name." input \"".$path."\"\n"); //add vod path fwrite($fp,"show\n"); //check if vod added sleep(1); //wait for server to put output $output = ''; $output.= stream_get_line($fp,8192,">")."<br /><br /><br />"; $output.= stream_get_line($fp,8192,">")."<br /><br /><br />"; $output.= stream_get_line($fp,8192,">")."<br /><br /><br />"; $output.= stream_get_line($fp,8192,">")."<br /><br /><br />"; echo "Checking file exists<br />"; $flag = stripos($output,$path); }while(!$flag); fclose($fp); echo "file sucessfully added to list "; $cfgfile = fopen($cfgpath,"a"); fwrite($cfgfile,"\nnew ".$name." vod enabled"); //load into the VOD config file fwrite($cfgfile,"\nsetup ".$name." input \"".$path."\"");//load into the VOD config file fclose($cfgfile); //close the config file } } echo "<a href=\"rtsp://localhost:5554/".$name."\">play movie</a>"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <link href="/css/template_css.css" rel="stylesheet" type="text/css" media="screen"/> <title>Processing request</title><meta name="ROBOTS" content="NOINDEX,NOFOLLOW,NOARCHIVE" /> </head> <body> <div id="main"> <p><h2>Your request is being processed</h2></p> <?php if (isset($_GET['path']) && $_GET['path'] != "") { $path = $_GET['path']; checkConfig ($path); } ?> </div> </body>
I made a batch command file called "vlcserverstart.bat" to start vlc's rtsp server.
here is the code inside it:

Code: Select all

c:\progra~1\videolan\vlc\vlc.exe -I telnet --control telnet --telnet-port 5555 --telnet-password rumman0679 --rtsp-host 0.0.0.0:5554
so i double-cliked the "vlcserverstart.bat" and checked in "task manager" for process "vlc.exe".
then i start xampp control panel and started apache and mysql(though mysql isnt necessary i suppose).
I browse to "http://localhost:80/index.php" or "http://127.0.0.1:80/index.php"
and found folder directory.
But whatever movie i go for it wait untill "max_execution time in php.ini located in "apache/bin/".
I checked .config file(vlm.config).
But it was empty after all of this mess.

P.S.I know a bit of C++(mine have a course on it on level2-term1),html,css,javascript,and also php,have little test of mysql while installing some script on my 2nd wife(PC :D ).

Can you help me with this "vod+vlc+scripting lan. marriage"?

JamesGuthrie
New Cone
New Cone
Posts: 8
Joined: 14 Oct 2009 23:25

Re: How to setup multi-user streaming server, web interfaced

Postby JamesGuthrie » 03 Feb 2011 18:36

Alright, that's narrowed things down a little bit.

I'm pretty sure I know where/what the problem is, but I'm not sure how it ought to be fixed. I'm going to have to ask you to fix this yourself, as I don't have the ability to look into this in-depth at the moment.

You mentioned before that you could see the text "connected to host via telnet" and then "Checking file exists" over and over again.

This allows me to determine that the problem is in these lines of code:

Code: Select all

echo "connected to host via telnet<br />"; do{ fwrite($fp,"rumman0679\n"); //password fwrite($fp,"new ".$name." vod enabled\n"); //add vod with generated name fwrite($fp,"setup ".$name." input \"".$path."\"\n"); //add vod path fwrite($fp,"show\n"); //check if vod added sleep(1); //wait for server to put output $output = ''; $output.= stream_get_line($fp,8192,">")."<br /><br /><br />"; $output.= stream_get_line($fp,8192,">")."<br /><br /><br />"; $output.= stream_get_line($fp,8192,">")."<br /><br /><br />"; $output.= stream_get_line($fp,8192,">")."<br /><br /><br />"; echo "Checking file exists<br />"; $flag = stripos($output,$path); }while(!$flag);
I'm going to ask you to use the skills you have to figure out the problem, this is what I think is going wrong:

The communication with vlc over telnet is broken somehow. This means that either we're telling vlc to do something which it doesn't understand, that vlc is telling us something that we don't understand, or something is going wrong with the communication channel with vlc. The result of this is that when we try to check to see if the file which we're supposed to be adding to vlc has been added, we don't get what we expect. This is either because the file isn't added correctly, or because the output given by vlc is not telling us what we were expecting. When I wrote this code, I started by connecting to the vlc software via telnet (using putty on windows) and added the files manually, I then observed the messages which were output by vlc and wrote the php to be able to automatically add the files, and interpret the output which vlc is giving.

To debug this part of the code, you could put the following line of code

Code: Select all

echo $output."<br />\n";
above the existing line of code:

Code: Select all

echo "Checking file exists<br />";
. This will give you an idea of what vlc is is actually telling us in the php code which I've written.

Another alternative is to try to add media manually to the vlc server by connecting to it via putty (if you don't have this yet, get it, just google "putty"). You'll need to connect to 127.0.0.1 on port 5555, using telnet (these are all settings in putty). Once you're connected, you will be "talking" to vlc. Once you're connected you can try adding a media file by typing:

Code: Select all

new testmedia
which makes vlc create a media instance called testmedia in its config file. You will still need to "setup" the media instance, by specifying where it is located etc. This can be done as follows:

Code: Select all

setup testmedia /path/to/file
I would suggest using something simple like c:\testmovie.avi for testing (try to avoid a path with spaces and odd characters etc).
once you've done this, you can type

Code: Select all

show
to get vlc to tell you which media files it currently knows about.

This process of communicating via telnet (using putty) with vlc is what we're doing with the php. If you can do it without problems then there's probably a bug in the php I've written.

For further debugging, it would be useful for me to see what the php is telling vlc when it executes the command

Code: Select all

fwrite($fp,"new ".$name." vod enabled\n"); //add vod with generated name fwrite($fp,"setup ".$name." input \"".$path."\"\n"); //add vod path
Maybe you could add the lines

Code: Select all

echo "new ".$name." vod enabled<br />\n"; echo "setup ".$name." input \"".$path."\"\n";
in there somewhere, so that we can get an idea whether the php is writing the correct stuff to vlc or not.

Let me know how that works out.


Return to “VLC media player for Windows Troubleshooting”

Who is online

Users browsing this forum: Bing [Bot] and 17 guests