How can I stream an mp3 file in a web page? - html

I want to integrate an mp3 audio file with a size of 20MB into my website (PHP 7, Apache webserver).
<audio id="myaudio" src="./assets/myaudio.mp3" preload=„none" controls></audio>
The mp3 file should not be loaded on every page load, only when someone presses the play button.
The mp3 file should be streamed and start to play immediately (no waiting for complete download)
The mp3 file should also run in Firefox.
Does anyone have an idea how I can achieve all this?

Streaming MP3
by Toby Mack
To stream MP3's on a page you will need to have an MP3 player like WinAmp, Windows Media Player, or Real Audio Player. The MP3 will stream as it loads on the page and will allow for longer larger sound files to be played.
Save your MP3 file to the same directory where you will be playing the sound from, or a sound directory which you know the URL for already,
Open up a notepad by clicking Start => Programs => Accessories => Notepad
Type in only the exact Address or URL of your MP3 file.
Type it in as simple as this:
http://example.com/sound/music.mp3
where the domain is your domain, the sound folder is where you placed your MP3, and the music.mp3 is your mp3 file.
Save this file as music.m3u . Upload this file into the directory where you will place your sound.
Open your page up in an editor such as Notepad that will allow you to edit the code on the page.
Insert the following code into the HTML code of your page for a clickable link to stream by using this:
Clickable player and doawnload this file by right clicking it and save to yur directory:
<img border="0" src= "mp3.gif" width="41" height="25">
Or you can embed with this:
<EMBED src="music.m3u" autostart=true hidden=true>
Or you can embed for both IE and Netscape with this:
<!This code for IE>
<EMBED SRC="http://example.com/sound/music.m3u" HIDDEN="true" AUTOSTART="true" width="128" height="128">
<!This code for Netscape>
<OBJECT ID="MediaPlayer"
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"
standby="Loading Microsoft Windows Media Player components..."
TYPE="application/x-oleobject" width="239" height="179">
<PARAM NAME="FileName" VALUE="http://server/path/your-file.asx">
<PARAM NAME="AnimationatStart" VALUE="false">
<PARAM NAME="TransparentatStart" VALUE="true">
<PARAM NAME="AutoStart" VALUE="true">
<PARAM NAME="ShowControls" VALUE="0">
<Embed TYPE="application/x-mplayer2"
pluginspage="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&"
SRC="http://example.com/sound/music.m3u"
Name=MediaPlayer
ShowControls=0
Width=2
Height=2
</embed>
</OBJECT>

Related

Video in local file system won't play from sibling folder

I am maintaining an HTML help system where assets have recently been split apart from HTML documents. I'm noticing that videos that will play when loaded from a local subfolder will not play when loaded from a sibling folder.
Here's a much reduced example: webroot/dir/a.html contains:
<html><body>
Here's a video:<p>
<object id="mediaPlayer" width="640" height="480"
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
type="application/x-oleobject">
<param name="fileName" value="../siblingdir/xxx.wmv">
<embed type="application/x-mplayer2"
pluginspage="http://microsoft.com/windows/mediaplayer/en/download/"
id="mediaPlayer" name="mediaPlayer"
src="../siblingdir/xxx.wmv">
</object>
</body></html>
Even though webroot/siblingdir contains xxx.wmv, the video will not play.
HOWEVER, if I drop the two "../siblingdir" elements in the above code and store the video in the same folder as the web page, the video will play.
Images will load from a sibling directory.
Can the video be made to play from a sibling folder? It this a security setting? Is it something that can be enabled or disabled?
Test platform is MSIE 11 on Windows 7 Enterprise.
<object id="mediaPlayer" width="640" height="480"
type="application/x-oleobject" data="../siblingdir/xxx.wmv">
<embed type="application/x-mplayer2"
id="mediaPlayer" name="mediaPlayer"
src="../siblingdir/xxx.wmv"/>
</object>
It is best if you publish your web page to a web server (localhost) or if you are using the local file system, publish your video files to the same windows folder as your source html file. Adjust the Advanced tab of Internet Options to "Allow active content in files on my computer to run.". eg. src="xxx.wmv"

How to play a video without embedded code in html?

I've got a webpage which works with a MySQLi DB (this is a private website just for our company and it is not something global). Now, I want to upload some videos on server (and not on the DB) and put their links on the website. Now, here is my question: How can I make browser to open Windows Media Player (after clicking on each link by a user) and play the video on the computer, and not on the browser??
As a matter of fact, I do not want the browser to show my videos to users, I want each user to watch videos by Windows Media Player on their computers.
I think a simple should work in your html
video link
I video should download, depending on your users prefrences the video may open after its finished downloading... you can't force this
If you want stream then this embed should work:
<object id='mediaPlayer' width="320" height="285"
classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'
codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'
standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>
<param name='fileName' value="http://www.yoursite.com/your-video.wmv">
<param name='animationatStart' value='true'>
<param name='transparentatStart' value='true'>
<param name='autoStart' value="false">
<param name='showControls' value="true">
<param name='loop' value="true">
<embed type='application/x-mplayer2'
pluginspage='http://microsoft.com/windows/mediaplayer/en/download/'
id='mediaPlayer' name='mediaPlayer' displaysize='4' autosize='-1'
bgcolor='darkblue' showcontrols="true" showtracker='-1'
showdisplay='0' showstatusbar='-1' videoborder3d='-1' width="320" height="285"
src="http://www.yoursite.com/your-video.wmv" autostart="true" designtimesp='5311' loop="true">
</embed>
</object>
Note:
You would be better off using html5 tags and converting to mp4 - not that many people use windows media player these days

Embed RTSP Video Stream on HTML Website

I would like to embed a video stream from an IP camera into a website.
The URL for this stream looks like this:
rtsp://my.camera.com/axis-media/media.amp
If I open the stream in VLC it is working fine.
I have tried to use stuff from here but nothing is working:
https://wiki.videolan.org/Documentation:WebPlugin
It can be done with VLC or Quicktime but the actual problem your most likely experiencing is that web browsers have stopped suporting the VLC and Quicktime plugins. At time of writing this reply only Firefox still supports this plugin.
This also means you need VLC or Quicktime installed on your PC (Which I gather you have since it plays the steam in VLC).
Try Firefox for now to see if your stream works.
If it asks to Activate the VLC / Quicktime plugin click Allow or Allow and remember.
When using VLC the HTML Code in your website should resemble this:
<div id="cctv-container">
<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab" id="vlc" events="True" width="640" height="480">
<param name="Src" value="rtsp://my.camera.com/axis-media/media.amp"/>
<param name="ShowDisplay" value="True"/>
<param name="AutoLoop" value="False"/>
<param name="AutoPlay" value="True"/>
<embed id="vlcEmb" type="application/x-google-vlc-plugin" version="VideoLAN.VLCPlugin.2" autoplay="yes" loop="no" target="rtsp://my.camera.com/axis-media/media.amp" width="640" height="480"/>
</object>
</div>
The only way at present to have it stream in Chrome or IE is to have VLC transcode the RSTP stream for you to a HTML5 supported stream.
Here is a sample VLC command to do just that:
vlc rtsp://my.camera.com/axis-media/media.amp :network-caching=1000 :sout=#transcode{vcodec=theo,vb=1600,scale=1,acodec=none}:http{mux=ogg,dst=:8181/stream} :no-sout-rtp-sap :no-sout-standard-sap :sout-keep
The new output stream can then be embedded in a HTML5 shim:
You can obviously change the port or encoding type as you see fit e.g.
:http{mux=flv,dst=:1234/stream}

Embedding WMV video file in HTML page using Silverlight plugin

I need to embed a video file codified in Windows Media Video format (WMV). The video files are send in streaming using Windows Media Services(in on Demand Mode) over HTTP protocol, and the client need to reproduce them.
I need to dinamically create a page with a video file embedded (each time the file and its path can change).
If I simply put in browser client the path of the file to reproduce, like:
http://myMediaServer:8000/stremVideo/pinball.wmv
automatically Windows Media Player opens, and I can control the reproduction of the video (seek forward, seek backward, pause or resume), without any problem, while if the video file is embedded in an HTML page, using the following code I can't seek the reproduction but I can only pause and resume the video.
<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" width="480" height="360" codebase="http://www.microsoft.com/Windows/MediaPlayer/">
<param name="Filename" value="http://remoteServer:8000/stremVideo/pinball.wmv">
<param name="AutoStart" value="true">
<param name="ShowControls" value="true">
<param name="BufferingTime" value="2">
<param name="ShowStatusBar" value="true">
<param name="AutoSize" value="true">
<param name="InvokeURLs" value="false">
<embed src="http://remoteServer:8000/stremVideo/pinball.wmv" type="application/x-mplayer2" autostart="1" enabled="1" showstatusbar="1" showdisplay="1" showcontrols="1" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0" width="480" height="360"></embed>
</object>
So, the questions are the following:
How can I obtain all the control for the embedded video file?
Someone suggest to use Silverlight plugin. How can I embed video in a HTML page using Silverlight plugin? I need to create a Silverlight application? If yes, I need to have one application for each video file I want reproduce?
You need to create one Silverlight player app and use it as more times as you want.
And you can control it via JS.
Silverlight is best solution for high-quality WMV on pages.
Params, which you defined, are params of Silverlight app and you must specify in app which params you must have and how they will be used.
There is an open source player frame work which may help: Have you looked at this? http://playerframework.codeplex.com/

Flash SWF not playing!

I created a custom video skin for my movie, and published the swf. The file plays on my Mac (using Flash player v9) but it will not play on my PC (using Flash player 10). When I uploaded it to the host, neither players will play the swf. The bitmaps in the flash file show up, but the movie won't play. I don't know if it is how I exported it or what, but it will not play! Any Idea why this is happening?
The video is hosted here:
http://hqinternetsolutions.com/YOGIPATCH/index.html
Here is my Actionscript:
flvPlayback.playPauseButton = playpausebtn;
flvPlayback.muteButton = mutebtn;
flvPlayback.volumeBar = volbar;
flvPlayback.seekBar = seekbar;
And my HTML embedded flash:
<div id="movie">
<object id="movie" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="440" height="273">
<param name="movie" value="file.swf">
<param name="quality" value="high">
<embed src="file.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="440"
height="273"></embed></object>
</div>
Just had a look using Firebug. Your swf appears to be referencing the following URL:
http://hqinternetsolutions.com/Users/larrykain/Desktop/flash%20skin/fullaquatic.flv
It's returning a 404 so it can't find the file. Looking at the URL, check the reference to how you've embedded it in the swf file.
This might be caused by different things:
Make sure the flv file is uploaded to the server along with the SWF.
Your FLV file might be blocked on the web server. Make sure it's not by pointing your browser to the actual FLV file directly (example: http://hqinternetsolutions.com/YOGIPATCH/myvideo.flv)
The flv path set in the FLVPlayback component might be too long.
Try adding a preceding / to the path of FLV in the component.