How to add http stream to web

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
Dupl3xx
New Cone
New Cone
Posts: 6
Joined: 18 Jun 2010 23:50

How to add http stream to web

Postby Dupl3xx » 18 Jun 2010 23:58

hello, i have some http streams (http://ip:8001, 8002...) and i try add some video player with this stream to web, but dont work for me.. how video player ?

can you help me please, what i must write to php file ? thx

codec: mp4v
resulution: 368/294
fps: 25

PS: i cant change some thing in stream from vlc

just-do-it
Cone that earned his stripes
Cone that earned his stripes
Posts: 152
Joined: 08 Aug 2006 00:51
Operating System: 'does/Linux
Location: uk
Contact:

Re: How to add http stream to web

Postby just-do-it » 19 Jun 2010 18:45

Ahh Go on; Go on

Dupl3xx
New Cone
New Cone
Posts: 6
Joined: 18 Jun 2010 23:50

Re: How to add http stream to web

Postby Dupl3xx » 19 Jun 2010 19:59

maybe, but if i paste my stream to this line and press go, do nothog.. and is somewher source code ? thx

just-do-it
Cone that earned his stripes
Cone that earned his stripes
Posts: 152
Joined: 08 Aug 2006 00:51
Operating System: 'does/Linux
Location: uk
Contact:

Re: How to add http stream to web

Postby just-do-it » 19 Jun 2010 20:03

try again no - my stream is running - at time of posting
Ahh Go on; Go on

Dupl3xx
New Cone
New Cone
Posts: 6
Joined: 18 Jun 2010 23:50

Re: How to add http stream to web

Postby Dupl3xx » 19 Jun 2010 20:23

it works in internet explorer but in mozilla firefox no ... is somewher this script ?

just-do-it
Cone that earned his stripes
Cone that earned his stripes
Posts: 152
Joined: 08 Aug 2006 00:51
Operating System: 'does/Linux
Location: uk
Contact:

Re: How to add http stream to web

Postby just-do-it » 19 Jun 2010 20:41

There are a number of things I fell over on
starting at the beginning I use this batch file to stream the video/audio

Code: Select all

rem stream sky mp4 with transcode to TS on 8080.bat c: cd "program files\videolan\vlc" vlc HTTP://Just-do-it.no-ip.org/_video/the_sky_at_night/skyatnight_aug07_16x9_bb.mp4 --loop :sout=#transcode{vcodec=mp2v,vb=254,scale=1,acodec=mp3,ab=128,channels=2}:duplicate{dst=std{a
once this batchfile iis going the stream can be recieved by any pc so long as your isp gives you a fast enough link (>2Mbps) and your firewall is not blocking port 8001

I run a wan, wireless router AND a firewall BOTH of which have to be configued to allow port 8001 to pass through
Last edited by just-do-it on 21 Jun 2010 01:46, edited 1 time in total.
Ahh Go on; Go on

just-do-it
Cone that earned his stripes
Cone that earned his stripes
Posts: 152
Joined: 08 Aug 2006 00:51
Operating System: 'does/Linux
Location: uk
Contact:

Re: How to add http stream to web

Postby just-do-it » 19 Jun 2010 20:55

http://just-do-it.no-ip.org/vlc/vlc%20q ... /index.htm may help - it covers my efforts to get there
Ahh Go on; Go on

Dupl3xx
New Cone
New Cone
Posts: 6
Joined: 18 Jun 2010 23:50

Re: How to add http stream to web

Postby Dupl3xx » 19 Jun 2010 22:51

nice it work good.. pleas, how to automatic start play ? i must delete MRL line and button go and i want start stream when i go to page... thx

just-do-it
Cone that earned his stripes
Cone that earned his stripes
Posts: 152
Joined: 08 Aug 2006 00:51
Operating System: 'does/Linux
Location: uk
Contact:

Re: How to add http stream to web

Postby just-do-it » 20 Jun 2010 15:07

the code for the page came from vlc forums and
a) it has now gone
b) mine starts automatically

here is the code

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <TITLE>VLC Plugin test page</TITLE> <STYLE> .inputTrackerInput { height:20; width:30; font-family : Arial, Helvetica, sans-serif; font-size : 12px; } </STYLE> <SCRIPT type="text/javascript" src="/blueshoes-4.5/javascript/lib/LibCrossBrowser.js"></SCRIPT> <SCRIPT type="text/javascript" src="/blueshoes-4.5/javascript/lib/EventHandler.js"></SCRIPT> <SCRIPT type="text/javascript" src="/blueshoes-4.5/javascript/core/form/Bs_FormUtil.lib.js"></SCRIPT> <SCRIPT type="text/javascript" src="/blueshoes-4.5/javascript/components/slider/Bs_Slider.class.js"></SCRIPT> <SCRIPT type="text/ecmascript"><!-- function init(){ inputTracker = new Bs_Slider(); inputTracker.attachOnChange(onInputTrackerChange); inputTracker.attachOnSlideStart(onInputTrackerScrollStart); inputTracker.attachOnSlideEnd(onInputTrackerScrollEnd); inputTracker.width = 530 ; inputTracker.height = 15; inputTracker.minVal = 0.0; inputTracker.maxVal = -1.0; inputTracker.valueDefault = 0.0; inputTracker.valueInterval = 1/530; inputTracker.setDisabled(true); inputTracker.imgDir = '/blueshoes-4.5/javascript/components/slider/img/'; inputTracker.setBackgroundImage('aluminumalloyvolcanic/horizontal_background.gif', 'repeat'); inputTracker.setArrowIconLeft('aluminumalloyvolcanic/horizontal_backgroundLeft.gif', 2, 19); inputTracker.setArrowIconRight('aluminumalloyvolcanic/horizontal_backgroundRight.gif', 2, 19); inputTracker.setSliderIcon('aluminumalloyvolcanic/horizontal_knob.gif', 15, 19); inputTracker.useInputField = 0; inputTracker.draw('inputTrackerDiv'); if( navigator.appName.indexOf("Microsoft Internet")==-1 ) { onVLCPluginReady() } else if( document.readyState == 'complete' ) { onVLCPluginReady(); } else { /* Explorer loads plugins asynchronously */ document.onreadystatechange=function() { if( document.readyState == 'complete' ) { onVLCPluginReady(); } } } } function getVLC(name) { if (window.document[name]) { return window.document[name]; } if (navigator.appName.indexOf("Microsoft Internet")==-1) { if (document.embeds && document.embeds[name]) return document.embeds[name]; } else // if (navigator.appName.indexOf("Microsoft Internet")!=-1) { return document.getElementById(name); } } function onVLCPluginReady() { updateVolume(0); }; //--></SCRIPT> <BODY onLoad="init();"> <TABLE> <TR><TD colspan="2"> MRL: <INPUT size="90" id="targetTextField" value="http://just-do-it.no-ip.org:8001"> <INPUT type=submit value="Go" onClick="doGo(document.getElementById('targetTextField').value);"> </TD></TR> <TR><TD align="center" colspan="2"> <!-- Insert VideoLAN.VLCPlugin.2 --> <OBJECT classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab#Version=0,8,6,0" width="320" height="240" id="vlc" events="True"> <param name="MRL" value="http://just-do-it.no-ip.org:8001" /> <param name="ShowDisplay" value="True" /> <param name="AutoLoop" value="False" /> <param name="AutoPlay" value="True" /> <param name="Volume" value="50" /> <param name="StartTime" value="0" /> <EMBED pluginspage="http://www.videolan.org" type="application/x-vlc-plugin" progid="VideoLAN.VLCPlugin.2" width="320" height="240" name="vlc"> </EMBED> </OBJECT> </TD></TR> <TR><TD colspan="2"> <TABLE><TR> <TD valign="top" width="550"> <!-- Insert Slider widget --> <DIV id="inputTrackerDiv"></DIV> </TD><TD width="15%"> <DIV id="info" style="text-align:center">-:--:--/-:--:--</DIV> </TD> </TR></TABLE> </TD></TR> <TR><TD> <INPUT type=button id="PlayOrPause" value=" Play " disabled onClick='doPlayOrPause();'> <INPUT type=button id="Stop" value="Stop" enabled onClick='doStop();'> &nbsp; <INPUT type=button value=" << " onClick='doPlaySlower();'> <INPUT type=button value=" >> " onClick='doPlayFaster();'> <INPUT type=button value=" <-> " onClick='getVLC("vlc").video.toggleFullscreen();'> AR: <SELECT readonly onChange='doChangeAspectRatio(this.value)'> <OPTION value="default">Default</OPTION> <OPTION value="1:1">1:1</OPTION> <OPTION value="4:3">4:3</OPTION> <OPTION value="16:9">16:9</OPTION> <OPTION value="221:100">221:100</OPTION> <OPTION value="5:4">5:4</OPTION> </SELECT> &nbsp;&nbsp; <INPUT type=button value="Version" onClick='alert(getVLC("vlc").VersionInfo);'> </TD><TD align="right"> <SPAN style="text-align:center">Volume:</SPAN> <INPUT type=button value=" - " onClick='updateVolume(-10)'> <SPAN id="volumeTextField" style="text-align: center">--</SPAN> <INPUT type=button value=" + " onClick='updateVolume(+10)'> <INPUT type=button value="Mute" onClick='getVLC("vlc").audio.toggleMute();'> </TD> </TR> </TABLE> <SCRIPT type="text/ecmascript"> <!-- var prevState = 0; var monitorTimerId = 0; var inputTrackerScrolling = false; var inputTrackerIgnoreChange = false; function updateVolume(deltaVol) { var vlc = getVLC("vlc"); vlc.audio.volume += deltaVol; document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%"; }; function formatTime(timeVal) { var timeHour = Math.round(timeVal / 1000); var timeSec = timeHour % 60; if( timeSec < 10 ) timeSec = '0'+timeSec; timeHour = (timeHour - timeSec)/60; var timeMin = timeHour % 60; if( timeMin < 10 ) timeMin = '0'+timeMin; timeHour = (timeHour - timeMin)/60; if( timeHour > 0 ) return timeHour+":"+timeMin+":"+timeSec; else return timeMin+":"+timeSec; }; function monitor() { var vlc = getVLC("vlc"); if( vlc.log.messages.count > 0 ) { // there is one or more messages in the log var iter = vlc.log.messages.iterator(); while( iter.hasNext ) { var msg = iter.next(); var msgtype = msg.type.toString(); if( (msg.severity == 1) && (msgtype == "input") ) { alert( msg.message ); } } // clear the log once finished to avoid clogging vlc.log.messages.clear(); } var newState = vlc.input.state; if( prevState != newState ) { if( newState == 0 ) { // current media has stopped onStop(); } else if( newState == 1 ) { // current media is openning/connecting onOpen(); } else if( newState == 2 ) { // current media is buffering data onBuffer(); } else if( newState == 3 ) { // current media is now playing onPlay(); } else if( vlc.input.state == 4 ) { // current media is now paused onPause(); } prevState = newState; } else if( newState == 3 ) { // current media is playing onPlaying(); } if( ! monitorTimerId ) { monitorTimerId = setInterval("monitor()", 1000); } }; /* actions */ var aspectRatio="default"; function doChangeAspectRatio(arValue) { var vlc = getVLC("vlc"); if( vlc.input.state && vlc.input.hasVout ) { vlc.video.aspectRatio = arValue; } aspectRatio = arValue; }; function doGo(targetURL) { var vlc = getVLC("vlc"); var options = new Array(":aspect-ratio="+aspectRatio); vlc.playlist.items.clear(); while( vlc.playlist.items.count > 0 ) { // clear() may return before the playlist has actually been cleared // just wait for it to finish its job } var itemId = vlc.playlist.add(targetURL, null, options); if( itemId != -1 ) { // clear the message log and enable error logging vlc.log.verbosity = 1; vlc.log.messages.clear(); // play MRL vlc.playlist.playItem(itemId); if( monitorTimerId == 0 ) { monitor(); } } else { // disable log vlc.log.verbosity = -1; alert("cannot play at the moment !"); } }; function doPlayOrPause() { var vlc = getVLC("vlc"); if( vlc.playlist.isPlaying ) { vlc.playlist.togglePause(); } else if( vlc.playlist.items.count > 0 ) { // clear the message log and enable error logging vlc.log.verbosity = 1; vlc.log.messages.clear(); vlc.playlist.play(); monitor(); } else { // disable log vlc.log.verbosity = -1; alert('nothing to play !'); } }; function doStop() { getVLC("vlc").playlist.stop(); if( monitorTimerId != 0 ) { clearInterval(monitorTimerId); monitorTimerId = 0; } onStop(); }; function doPlaySlower() { var vlc = getVLC("vlc"); vlc.input.rate = vlc.input.rate / 2; }; function doPlayFaster() { var vlc = getVLC("vlc"); vlc.input.rate = vlc.input.rate * 2; }; /* events */ function onOpen() { document.getElementById("info").innerHTML = "Opening..."; document.getElementById("PlayOrPause").disabled = true; document.getElementById("Stop").disabled = false; }; function onBuffer() { document.getElementById("info").innerHTML = "Buffering..."; document.getElementById("PlayOrPause").disabled = true; document.getElementById("Stop").disabled = false; }; function onPlay() { document.getElementById("PlayOrPause").value = "Pause"; document.getElementById("PlayOrPause").disabled = false; document.getElementById("Stop").disabled = false; onPlaying(); }; var liveFeedText = new Array("Live", "((Live))", "(( Live ))", "(( Live ))"); var liveFeedRoll = 0; function onPlaying() { if( ! inputTrackerScrolling ) { var vlc = getVLC("vlc"); var info = document.getElementById("info"); var mediaLen = vlc.input.length; inputTrackerIgnoreChange = true; if( mediaLen > 0 ) { // seekable media if( inputTracker.maxVal != 1.0 ) { document.getElementById("PlayOrPause").disabled = false; inputTracker.setDisabled(false); inputTracker.maxVal = 1.0; } inputTracker.setValue(vlc.input.position); info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(mediaLen); } else { // non-seekable "live" media if( inputTracker.maxVal != 0.0 ) { document.getElementById("PlayOrPause").disabled = true; inputTracker.maxVal = 0.0; inputTracker.setValue(0.0); inputTracker.setDisabled(true); } liveFeedRoll = liveFeedRoll & 3; info.innerHTML = liveFeedText[liveFeedRoll++]; } inputTrackerIgnoreChange = false; } }; function onPause() { document.getElementById("PlayOrPause").value = " Play "; }; function onStop() { var vlc = getVLC("vlc"); // disable logging vlc.log.verbosity = -1; document.getElementById("Stop").disabled = true; if( ! inputTracker.disabled ) { inputTrackerIgnoreChange = true; inputTracker.setValue(0.0); inputTracker.setDisabled(true); inputTracker.maxVal = 0.0; inputTrackerIgnoreChange = false; } document.getElementById("info").innerHTML = "-:--:--/-:--:--"; document.getElementById("PlayOrPause").value = " Play "; document.getElementById("PlayOrPause").disabled = false; }; function onInputTrackerScrollStart() { inputTrackerScrolling = true; }; function onInputTrackerScrollEnd(inputTracker, value, pos) { inputTrackerScrolling = false; }; function onInputTrackerChange(inputTracker, value, pos) { if( ! inputTrackerIgnoreChange ) { var vlc = getVLC("vlc"); if( (vlc.input.state == 3) && (vlc.input.position != value) ) { var info = document.getElementById("info"); vlc.input.position = value; info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(vlc.input.length); } } }; //--> </SCRIPT> </BODY> </HTML>
prehaps someone would like to tell us why we should NOT use it...?
Ahh Go on; Go on

Greg
Cone that earned his stripes
Cone that earned his stripes
Posts: 316
Joined: 24 Feb 2009 00:37

Re: How to add http stream to web

Postby Greg » 20 Jun 2010 23:39



Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 6 guests