Want a single page with multiple links to flash (.flv) videos.

Goatmetal
Goatmetal used Ask the Experts™
on
I need a script for a single webpage containing links to flash (.flv) videos that when a person would click on a link, the video would play either in that same page or a new window. Right now, I have a webpage with 50 links to videos, but each link is to an html for that specific video. In other words, I have 50 htmls for just that page alone. Is there a way where I can have the page of 50 links to videos, but combine all those htmls into one? I hope I'm explaining this good enough. Oh also...I'm not really familiar with types of scripts...But I need it to be in the format that uses commands suchs as <html> <body> <div> etc...
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Michel PlungjanIT Expert
Top Expert 2009

Commented:
Assuming you have the same html for all the pages and only the flv changes, try this

<html>
<head>
<script type="text/javascript">
function crtHtml(fileName) {
  return '<object .... src="'+fileName+'" ....></object>'
}
function showFlv(fileName) {
  if (document.getElementById("newWindow").checked) {
    var w = window.open("","newwin","width=500,height=300");
    w.document.write('<body onLoad="window.focus()">'+crtHtml(fileName)+'</body>')
    w.document.close();
  }
  else document.getElementById('flvContainer').innerHTML=crtHtml(fileName);
  return false;
}
</script>
</head>
<body>
<div id="flvContainer"></div>
<input type="checkbox" id=newWindow">Show in new window?<br>
<a href="#" onClick="return showFlv('video1.flv')">Video 1</a>
<a href="#" onClick="return showFlv('video2.flv')">Video 2</a>
.
.
.

Open in new window

Author

Commented:
Hello, I'm going to try that right now. But just wanted you to know that you assumed exactly right. The htmls are all the same and like you said just the flv changes. Ok...I'll let you know in a little bit. Thank you. I appreciate it.

Author

Commented:
Hmmm...I don't think I filled everything in correctly. Nothing played. I did however see a check box, with Video 1 and Video 2. Was I supposed to put some sort of player in the same area? I'm sorta new to all this. I made a little picture of what I would like if that helps. I guess it's sorta like Youtube. With the player on the left side and a list of videos on the right. But when any video is clicked, I don't want the page to reload. Just automatically plays in the same player.
untitled.PNG
11/26 Forrester Webinar: Savings for Enterprise

How can your organization benefit from savings just by replacing your legacy backup solutions with Acronis' #CyberProtection? Join Forrester's Joe Branca and Ryan Davis from Acronis live as they explain how you can too.

Michel PlungjanIT Expert
Top Expert 2009

Commented:
Please show your html

Author

Commented:
Ok...I copied exactly what you posted, and tried to fill in all that I needed to. Here's what I got.


<html>
<head>
<script type="text/javascript">
function crtHtml(Family Guy - Family Feud.flv) {
  return '<object .... src="http://www.bloodshows.com/videos/Family Guy - Family Feud.flv" ....></object>'
}
function showFlv(Family Guy - Family Feud.flv) {
  if (document.getElementById("newWindow").checked) {
    var w = window.open("","newwin","width=500,height=300");
    w.document.write('<body onLoad="window.focus()">'+crtHtml(Family Guy - Family Feud.flv)+'</body>')
    w.document.close();
  }
  else document.getElementById('videos').innerHTML=crtHtml(Family Guy - Family Feud.flv);
  return false;
}
</script>
</head>
<body>
<div id="videos"></div>
<input type="checkbox" id=newWindow">Show in new window?<br>
<a href="#" onClick="return showFlv('video1.flv')">Video 1</a>
<a href="#" onClick="return showFlv('video2.flv')">Video 2</a>
.
.
.
Michel PlungjanIT Expert
Top Expert 2009

Commented:
What do you mean "exactly" ??
You only needed to change the ... and the filenames, but not the variable names


<html>
<head>
<script type="text/javascript">
function crtHtml(fileName) {
  return '<object src="'+fileName+'></object>'
}
function showFlv(fileName) {
  if (document.getElementById("newWindow").checked) {
    var w = window.open("","newwin","width=500,height=300");
    w.document.write('<body onLoad="window.focus()">'+crtHtml(fileName)+'</body>')
    w.document.close();
  }
  else document.getElementById('videos').innerHTML=crtHtml(fileName);
  return false;
}
</script>
</head>
<body>
<div id="videos"></div>
<input type="checkbox" id=newWindow">Show in new window?<br>
<a href="#" onClick="return showFlv('Family%20Guy%20-%20Family%20Feud.flv')">Video 1</a>

Open in new window

Author

Commented:
Exactly meaning precisely. Ugh...You know what I mean. I copied what you posted word for word, symbol for symbol, character for character and pasted it in notepad. Then I went and entered in everything that I believed I was supposed to enter in. Then I named it video.html. Clicked on it, and it just showed a small check box with "show in new window" and under it "Video 1". I tried clicking on Video 1, but nothing happened.

Here's exactly what I have in the html that I clicked on.....I mean, here's identically, photocopied precisely what I have in the html:

<html>
<head>
<script type="text/javascript">
function crtHtml(familyguy.flv) {
  return '<object src="'+familyguy.flv+'></object>'
}
function showFlv(familyguy.flv) {
  if (document.getElementById("newWindow").checked) {
    var w = window.open("","newwin","width=500,height=300");
    w.document.write('<body onLoad="window.focus()">'+crtHtml(familyguy.flv)+'</body>')
    w.document.close();
  }
  else document.getElementById('videos').innerHTML=crtHtml(familyguy.flv);
  return false;
}
</script>
</head>
<body>
<div id="videos"></div>
<input type="checkbox" id=newWindow">Show in new window?<br>
<a href="#" onClick="return showFlv('familyguy.flv')">Video 1</a>
IT Expert
Top Expert 2009
Commented:
So did you look at all at what I just posted?

I will bnow go BACK and remove what you do NOT need to change

LEAVE fileName and the rest of the script alone!!!

ONLY change the href and leave the single quotes
<a href="#" onClick="return showFlv('familyguy.flv')">Video 1</a>

<html>
<head>
<script type="text/javascript">
function crtHtml(fileName) { // variable name to pass the passed file name into - DO NOT CHANGE THIS
  return '<object type="application/x-shockwave-flash" width="400" height="350" src="'+fileName+'></object>'; // I added the stuff that you missed with the ... 
}
function showFlv(fileName) {
  if (document.getElementById("newWindow").checked) {
    var w = window.open("","newwin","width=500,height=300");
    w.document.write('<body onLoad="window.focus()">'+crtHtml(fileName)+'</body>')
    w.document.close();
  }
  else document.getElementById('videos').innerHTML=crtHtml(fileName);
  return false;
}
</script>
</head>
<body>
<div id="videos"></div>
<input type="checkbox" id=newWindow">Show in new window?<br>
<a href="#" onClick="return showFlv('familyguy.flv')">Video 1</a>

Open in new window

Michel PlungjanIT Expert
Top Expert 2009

Commented:
possilby

src="FlashPlayer.swf?file='+fileName+'...

or similar - show me the original object tag and I can add the data

Author

Commented:
My website is going to be closed soon. So I won't be able to use the htmls. But thank you for trying to help me. I appreciate it.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial