SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member
    Join Date
    Aug 2002
    Location
    Notts, UK
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dynamic embedded media player in webpages

    My WMV video content is growing at an alarming rate and I want to try and make thinks look a little more integrated into the site and simpler to add new content.

    What I'm looking for is to have a single popup window that I can use to stream any video on the site.

    humm, better put this another way.

    Rather than create a separate pop up window with embedded media for each separate video on the server, is it possible on an index page to have a script of some kind that will pass the URL of the video the visitor wishes to view to the pop window, or create a new popup window with the choosen video URL passed on.
    Like a standard template that any video on the site can use.

    Everything in the video popup window would be the same, apart from the URL of the video that needs to be passed from the referring page.

    I don't really know a lot about JS, but I'm guessing that's how it would be achieved.

    Any help appreciated.


    R,

    Damo

    Xserv Digital

  2. #2
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What you need is something like this:
    http://www.hotscripts.com/Detailed/13232.html

    Pass the file name of your video to your window as a querystring, ie: your code might be

    Code:
    <a href="javascript:window.open('showvideo.html?path=video001.wmv')">
    Then use this JavaScript to retrieve the file path from the querystring and place it into your embed tag. See?

    Word of warning -- users are STUPID. If you're not firing a different window for each video then make sure your target window is opened and then focused, otherwise I guarantee you that some idiots will lose the window behind your page and complain that the links don't work. Of course, the links are working fine -- they're opening the movies in a window they can't see cos it's behind the main site!

    G

  3. #3
    SitePoint Member
    Join Date
    Aug 2002
    Location
    Notts, UK
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahhh.. thanks. I think that'll do the trick...

    Now for my next question, how do I use the JS command to get the information needed inside the parameter object tag?

    I assume I can't just insert JS into an activex object, although I'm playing with it now.

    R,

    Damo

    Xserv Digital

  4. #4
    SitePoint Member
    Join Date
    Aug 2002
    Location
    Notts, UK
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know if this is me been a total idiot, but I only seem to be able to display the data in the viewable window, and not the source code. (Which is where it needs to be so the activex object can read it)

    If I use the suggested script and call the data from the URL with this code..

    <script language="JavaScript"><!--
    var path = Request.QueryString("path");
    document.write(path);
    // --></script>
    It will display the URL in the document window, but no matter what method I try, I can't get the URL to appear in the source code.

    Any ideas?

  5. #5
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this in the HTML head:

    Code:
    <script language="JavaScript">
    var path = Request.QueryString("path");
    </script>
    And then write your object or embed tags by inserting this in your HTML wherever you need the object to be this (I'm using Flash as my example and just the embed tag but you can see what I'm doing ...):

    Code:
    <script language="JavaScript">
    document.writeln('<embed src="' + document.write(path) + '" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="320" height="245" loop="false">');
    document.writeln('</embed>');
    </script>

  6. #6
    SitePoint Member
    Join Date
    Aug 2002
    Location
    Notts, UK
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was trying to do what you suggested last night to no avail.

    I can't understand why it won't insert the URL in the source where + document.write(path) + is.

    What I've quoted below is the HTML document I've created, this is also exactly what appears when I view the source from IE too.





    <html>
    <head>
    <title>Video Window</title>
    <script type="text/javascript" src="CSJSRequestObject.js"></script>

    <script language="JavaScript">
    var path = Request.QueryString("path");
    </script>
    </head>

    <body>


    <P>
    <script language="JavaScript">

    document.writeln('<OBJECT ');
    document.writeln('ID="mediaPlayer"');
    document.writeln('CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"');
    document.writeln('CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"');
    document.writeln('STANDBY="Loading Microsoft Windows Media Player components..."');
    document.writeln('TYPE="application/x-oleobject">');
    document.writeln('<PARAM NAME="fileName" VALUE="' + document.write(path) + '">');
    document.writeln('<PARAM NAME="animationatStart" VALUE="true">');
    document.writeln('<PARAM NAME="transparentatStart" VALUE="true">');
    document.writeln('<PARAM NAME="autoStart" VALUE="true">');
    document.writeln('<PARAM NAME="showControls" VALUE="true">');
    document.writeln('</OBJECT>');

    </script>


    </body>
    </html>

  7. #7
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Odd! I don't know enough about JS really, but I use that method here with a centred layer script that I found and it seems fine .....

    Code:
    <SCRIPT LANGUAGE="JavaScript" type="text/javascript">
    n = (document.layers) ? 1:0
    ie = (document.all) ? 1:0
    
    if (n) {
    	windowWidth = window.innerWidth-16
    	windowHeight = window.innerHeight
    }
    if (ie) {
    	windowWidth = document.body.offsetWidth-20
    	windowHeight = document.body.offsetHeight
    }
    
    document.writeln('<STYLE TYPE="text/css">');
    document.writeln('<\!--');
    document.writeln('#centerLayer {position:absolute; left:'+(windowWidth/2-780/2)+'; top:'+(windowHeight/2-440/2)+'; width:760; height:430; clip:rect(0,780,440,0); z-index:1');
    document.writeln('-->');
    document.writeln('</STYLE>');
    </SCRIPT>
    http://surprisingcareers.co.uk/training.html

    Can't imagine why it wouldn't work for you ....


  8. #8
    SitePoint Zealot
    Join Date
    Jul 2002
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This has nothing to do with the topic at hand, but Greg, did you do this site? (http://surprisingcareers.co.uk/training.html) If so, did you know the IE6 image toolbar pops up (and covers the first link) when the mouse pointer is somewhere over the image?
    Of course it's only a minor detail, but I imagine a lot of people must have been cursing that thing...

  9. #9
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It does. The context is that the document.writeln should be working and does here. I wasn't posting it as a solution .....

    Yer. I noticed that. Pain in the rear end. Still, I work with what designers give me and that was the best way implement the flats I received. I doubt anyone's cursing though. It hardly makes a difference.

    G

    Edit:

    Coincidentally, <META HTTP-EQUIV="imagetoolbar" CONTENT="no"> kills the 'Image Toolbar'.
    Last edited by greg.harvey; Sep 3, 2002 at 09:20.

  10. #10
    Non-Member Musicbox's Avatar
    Join Date
    Nov 2004
    Location
    india
    Posts
    1,331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use Musicbox,it lets you play your music files in embedded player for more information visit http://www.princeofkings.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •