Page 1 of 1

playing from a urls in a database

Posted: 15 Mar 2011 15:20
by richard6235
Hey
I have a database with udp streams like so -> udp://@239.100.1.1:4422, Using a PHP script to get the stream as a string onto the webpage how would I then play this stream in VLC object?

I have already got these streams to play by manually adding them into the playlist, but my client has told me the streams may change hence the database.

Thanks

Ric

Re: playing from a urls in a database

Posted: 12 Apr 2011 06:31
by TKE
I am also interested in this answer.

Re: playing from a urls in a database

Posted: 14 Apr 2011 18:31
by lightfighter
Hi there,

There was another post that answered your question, but it only has the Play and Stop buttons. I can't figure out how to add Pause or Fullscreen, or any other controls. However, since you said you are using PHP from a database, here is the code modified to pull the movie from a database.

Code: Select all

<script language="javascript"> function play(obj, uri) { var obj = document.getElementById(obj); obj.playlist.add(uri,uri, ""); obj.playlist.play(); } function stop(obj) { var obj = document.getElementById(obj); obj.playlist.stop(); } function pause(obj) { var obj = document.getElementById(obj); obj.playlist.pause(); } function init() { play('vlc1', 'http://<?php echo $address; ?>/<?php echo $row['alias']; ?>/<?php echo $row['link']; ?>'); } </script> <OBJECT> <embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2" width="500" height="480" rtsp-caching="80" id="vlc1"> </embed> </OBJECT> <button onclick="play('vlc1', 'http://<?php echo $address; ?>/<?php echo $row['alias']; ?>/<?php echo $row['link']; ?>');">start</button> <button onclick="pause('vlc1');">pause</button> <button onclick="stop('vlc1');">stop</button>
I've got the variable "address" set to be the IP address of the host, and the variable "alias" set to be the external hard drive the movie is on, and the variable "link" set to be the file name. You can easially change these to suit your needs, by changing the http: address using your own php variables.