Log in

View Full Version : Looking for Videos and Music Player script through url method !!



Debendra Oli
11-27-2013, 06:19 AM
Guys, you have ? Or can create such script tha can play a music and videos online by the file url directly?

djr33
11-27-2013, 06:41 AM
http://lmgtfy.com/?q=embed+video
http://lmgtfy.com/?q=embed+audio

Debendra Oli
11-27-2013, 10:11 AM
It mean i can put url of a file in q=:embed-audio/video:

molendijk
11-28-2013, 12:00 AM
There are many ways to do it. The simplest one is to use the url in a string 'containing' an iframe whose src specifies the url. For instance, if your url is http://www.youtube.com/embed/mlloT_NY8sA?rel=0, the string could look like

'<iframe src="http://www.youtube.com/embed/mlloT_NY8sA?rel=0" style="width: 500px; height: 400px"><\/iframe>'
If we want to put this in a div, say <div id="video_div"></div>, we can write lines like the following:

<script>
var video1='<iframe src="http://www.youtube.com/embed/mlloT_NY8sA?rel=0" style="width: 500px; height: 400px"><\/iframe>'
</script>
<div id="video_div"></div>
<a href="javascript: void(0)" onclick="document.getElementById('video_div').innerHTML=video1">play</a>
The same technique can be followed for audio-urls.

If we want to make this a bit more sophisticated, we could do:

<script>
function load_video_audio(url,id)
{
document.getElementById(id).innerHTML = '<iframe src="http://www.youtube.com/embed/'+url+'" style="width: 500px; height: 400px"><\/iframe>'
}
</script>

<a href="javascript: void(0)" onclick="load_video_audio('mlloT_NY8sA?rel=0','video_div')">play</a><br>
<div id="video_div"></div>