Avatar billede bambino Nybegynder
27. februar 2001 - 00:06 Der er 6 kommentarer og
1 løsning

Javascipt der pauser asx-film fra en anden frame

Hej..

Jeg sidder og leger med lidt streaming video og det virker sådan set fint.

Knapper og player-vindue er opbygget vha. et javascript vis kode jeg har indsat i det nedenstående. Jeg kunne godt tænke mig at få videoklippet til at pause ved et klik i en anden frame i mit frameset.

Video-javascriptet er f.eks. i midten i et frameset og når man så klikker på et link, billede eller noget i f.eks. en topframe eksempelvis pauser filmen i midterrammen. Jeg ved godt at pausefunktionen selvfølgelig er i mit script nu, men kun så det virker i den ramme hvor film og kode er. Det skal siges at jeg bestemt ingen Javascript-haj er.

Håber I kan hjælpe mig på forhånd tak - her er koden:

<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">

<html>
<head>
    <title>Mediatest</title>

<script LANGUAGE=\"JavaScript\">

var sBaseUrl = \"pre_player.asp\";

var iPlayState = 2;            // Since we autostart the player on load, assume this is 2
                            // 0 = Stopped, 1 = Paused, 2 = Playing
var sPrevButtonImg = \"\";    // Used in onMouseOver and onMouseOut events               
var bPrevImageSet = false;    // Don\'t set more than once (IE will do this, which sets incorrect image name)

// Since Netscape and IE use different document object models, we\'ll
// set up a abbreviation named Player that points to the appropriate
// reference method
var Player;
var sContentUrl = \"test.asx\";    // Default clip name

// If we made a specific request for a clip, it\'s in the searchstring
var sUrlArgs = window.location.search.substring(1);
var sClip            = argValue(\"clip\");   
if (sClip.length > 1) sContentUrl = sClip;

function retrieveArgValue (iValue) {
  var sTemp = sUrlArgs.indexOf (\"&\", iValue);
  if (sTemp == -1)    sTemp = sUrlArgs.length;
  return unescape(sUrlArgs.substring(iValue, sTemp));
}

function argValue (sValue) {
  var sName = sValue + \"=\";
  var iNameLen = sName.length;
  var iUrlLen = sUrlArgs.length;
  var i = 0;
  while (i < iUrlLen) {
    var j = i + iNameLen;
    var sLowerCaseStr = sUrlArgs.substring(i, j).toLowerCase    // Convert to lower case
    var sLowerCaseName = sName.toLowerCase;                        // Convert to lower case
    if (sLowerCaseStr == sLowerCaseName) {                        // Compare the converted strings
      return retrieveArgValue (j);                                // return arg after = sign (mode=audio, for example)
    }
    i = sUrlArgs.indexOf(\"&\", i) + 1;
    if (i == 0) break;
  }
  return \"\";    // Return empty string, not a null, if empty
}

function SetPlayerReference() {
    if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
        Player = eval(\'document.PlayerDiv.document.NSPlay\');    // Netscape Player object
    }else {Player = eval(\'document.all.NSPlay\');}                    // IE Player object
}

function ToggleSlider() {
    var oImage;        // Create a variable that will reference the player
   
    // Choose a method to reference the slider button, based on the
    // document object model of the browser involved
    if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
        oImage = eval(\'document.DivSlider.document.Slider\');
    }else {oImage = eval(\'document.all.Slider\');}
   
    // Determine which state button is in, then toggle
    if (bToggleLeft == true) {                    // Boolean variable to store button state
        oImage.src = \'Images/SlideRight.gif\';    // Swap the image
        bToggleLeft = false;                    // Toggle the variable value
    } else {
        oImage.src = \'Images/SlideLeft.gif\';    // Swap the image
        bToggleLeft = true;                        // Toggle the variable value
    }
    if (navigator.userAgent.indexOf(\"IE\") != \"-1\") {
        // An attempt to make IE quit displaying hourglass cursor
        ToggleSlider.returnValue = false;   
    }
}

function renderASXInfo(){
    // Since Netscape and IE use different document object models, we\'ll
    // set up a abbreviation named Player that points to the appropriate
    // reference method
    if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
        Player = eval(\'document.PlayerDiv.document.NSPlay\');
    }else {Player = eval(\'document.NSPlay\');}

    // The following variables are filled from the player values
    var sTitle              = Player.GetMediaInfoString(8);
    var sAuthor                = Player.GetMediaInfoString(9);
    var sCopyright            = Player.GetMediaInfoString(10);
    var sMoreInfo            = Player.GetMediaInfoString(11);
    var sTempCategory         = \"\";

    if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
        // This section is Netscape-specific
        // (again, due to document object model differences)
        // NS requires that we doc.write into the DIV, while
        // IE requires that we set the innerHTML property
        document.Title.document.write(\"\");
        document.Title.document.close();
        document.Title.document.write(\'<FONT FACE=\"Arial, Helvetica\" SIZE=4><B>\' + sTitle + \'</B></FONT>\');
        document.Title.document.close();
        document.Copyright.document.write(\'<FONT FACE=\"Arial, Helvetica\" SIZE=2>\' + sCopyright + \'</FONT>\');
        document.Copyright.document.close();
        document.Author.document.write(\'<FONT FACE=\"Arial, Helvetica\" SIZE=2>\' + sAuthor + \'</FONT>\');
        document.Author.document.close();
        document.MoreInfo.document.write(\'<FONT FACE=\"Arial, Helvetica\" SIZE=2>\' + sMoreInfo + \'</FONT>\');
        document.MoreInfo.document.close();
    } else {
        // This section is for IE
        document.Title = \"\"
        if (sTitle)        document.all.Title.innerHTML = sTitle;
        if (sCopyright) document.all.Copyright.innerHTML = sCopyright;
        if (sAuthor)    document.all.Author.innerHTML = sAuthor;
        if (sMoreInfo)    document.all.MoreInfo.innerHTML = sMoreInfo;
    }
        NetscapeLoop();            // Recurse every two seconds, if we\'re Netscape
}

function NetscapeLoop(){
    // This loop is called from ScriptFrame.renderASXInfo()
    // Because Netscape\'s event model doesn\'t listen to events that \"bubble up\"
    // from embedded objects (the player, in this case), we have to periodically
    // inspect the current properties of the player.
    // Every two seconds, we update the screen with what\'s playing
    if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
        setTimeout(\'renderASXInfo();\',2000);
    }
}

function ButtonOver(sBtnName) {
    // Called by onMouseOver
    var oButton;            // Reference to button
    // Tired of different object models yet?
    if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
        oButton = eval(\'document.\' + sBtnName + \'.document.\' + sBtnName + \'Btn\');
    }else {
        oButton = eval(sBtnName + \'Btn\');
    }
    var sImageName = \'images/\' + sBtnName + \'_Over.gif\';
    if (bPrevImageSet == false) {
        sPrevButtonImg = oButton.src;            // Save the image name for use in onMouseOut
        bPrevImageSet = true;                    // To prevent setting with the mouseover image
    }
    oButton.src = sImageName;
}

function ButtonOut(sBtnName) {
    // Called by OnMouseOut
    var oButton;            // Reference to button
    // Tired of different object models yet?
    if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
        oButton = eval(\'document.\' + sBtnName + \'.document.\' + sBtnName + \'Btn\');
    }else {
        oButton = eval(sBtnName + \'Btn\');
    }
    oButton.src = sPrevButtonImg;        // Restore the image path we saved in onMouseOver
    bPrevImageSet = false;                // Restore permission to set onMouseOver image
}

function ButtonClick(sBtnName) {
    var oButton;            // Reference to button. Must specifically set due to MouseOut logic
    // Tired of different object models yet?
    if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
        oButton = eval(\'document.\' + sBtnName + \'.document.\' + sBtnName + \'Btn\');
    }else {
        oButton = eval(sBtnName + \'Btn\');
    }
    var sImageName = \'images/\' + sBtnName + \'_On.gif\';
    oButton.src = sImageName;            // Set the button image
    sPrevImageSet = false;                // Reset the flag
    sPrevButtonImg = oButton.src;        // So onMouseOut doesn\'t restore an old image               
}

function ButtonOff(sBtnName) {
    // Called from various functions to set specific button images to \"off\"
    var oButton;            // Reference to button
    // Tired of different object models yet?
    if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
        oButton = eval(\'document.\' + sBtnName + \'.document.\' + sBtnName + \'Btn\');
    }else {
        oButton = eval(sBtnName + \'Btn\');
    }
    var sImageName = \'images/\' + sBtnName + \'_Off.gif\';
    oButton.src = sImageName;            // Set the button image
}

function SetButtonPlayState() {
    // set all buttons to appropriate state, based on current play state
    if (iPlayState == 0) {        // Stopped
        ButtonOff(\'Previous\');
        ButtonOff(\'Pause\');
        ButtonOff(\'Play\');
        ButtonOff(\'Next\');
    }
    if (iPlayState == 1) {        // Paused
        ButtonOff(\'Previous\');
        ButtonOff(\'Stop\');
        ButtonOff(\'Play\');
        ButtonOff(\'Next\');
    }
    if (iPlayState == 2) {        // Play
        ButtonOff(\'Previous\');
        ButtonOff(\'Stop\');
        ButtonOff(\'Pause\');
        ButtonOff(\'Next\');
    }
}

function StopNsPlayer() {
    if (iPlayState > 0) {
        iPlayState = 0;
        Player.Stop();
        SetButtonPlayState();    // Reset button states
        ButtonClick(\'Stop\');
    }
}

function StartNsPlayer() {
    if (iPlayState < 2) {
        iPlayState = 2;
        Player.Play();
        SetButtonPlayState();    // Reset button states
        ButtonClick(\'Play\');
    }
}

function PauseNsPlayer() {
    if (iPlayState == 2) {
        iPlayState = 1;
        Player.Pause();
        SetButtonPlayState();    // Reset button states
        ButtonClick(\'Pause\');
    }
}

function Next() {
    Player.Next();
    StartNsPlayer();
}

function Previous() {
    Player.Previous();
    StartNsPlayer();
}

function PlayClip(sClipName) {
    location.href = sBaseUrl + \'?clip=\' + sClipName;
}
//-->
</script>

<script LANGUAGE=\"JavaScript\" FOR=\"NSPlay\" EVENT=\"NewStream()\">
<!--
    // Netscape doesn\'t support the FOR=\"NSPlay\" statement, so it fires this code just once
    // on window initialization. We force the code to wait three seconds in order to
    // give the plugin time to instantiate. You may need to increase the wait period
    // on slow machines
   
    // IE fires this code on each NewStream() event that bubbles up from the player
    if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
        setTimeout(\'SetPlayerReference();\', 2500);
        setTimeout(\'renderASXInfo();\',3000);
    } else {
        SetPlayerReference();
        renderASXInfo();
    }
//-->
</script>

</head>

<script LANGUAGE=\"JavaScript\">
<!--

if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
    document.write(\'<BODY bgColor=\"White\">\');
} else {
    document.write(\'<BODY bgColor=\"Black\">\');
}
//-->
</script>
<body bgcolor=\"#000000\">
<basefont face=\"Arial, Helvetica, Sans Serif\" size=\"4\" color=\"black\">
<div ID=\"Previous\" NAME=\"Previous\" STYLE=\"Position: absolute; Left:243px; Top:375px;\">
  <script LANGUAGE=\"JavaScript\">
if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
    // Only include an HREF for Netscape -- IE stops playing when HREF click is detected (instead of restarting)
    document.write(\'<A HREF=\"java script:Previous()\" onMouseOver=\"ButtonOver(\\\'Previous\\\')\" onMouseOut=\"ButtonOut(\\\'Previous\\\')\">\');
}
</script>
  <img ID=\"PreviousBtn\" Name=\"PreviousBtn\" SRC=\"images/Previous_Off.gif\" BORDER=\"0\" OnClick=\"java script:Previous()\" onMouseOver=\"ButtonOver(\'Previous\')\" onMouseOut=\"ButtonOut(\'Previous\')\">
  <script LANGUAGE=\"JavaScript\">
if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
    document.write(\'</A>\');
}
</script>
</div>

<div ID=\"Stop\" NAME=\"Stop\" STYLE=\"Position: absolute; Left:245px; Top:318px;\">
  <a HREF=\"java script:StopNsPlayer()\" onMouseOver=\"ButtonOver(\'Stop\')\" onMouseOut=\"ButtonOut(\'Stop\')\">
  <img Name=\"StopBtn\" SRC=\"images/Stop_Off.gif\" BORDER=\"0\" onMouseOver=\"ButtonOver(\'Stop\')\" onMouseOut=\"ButtonOut(\'Stop\')\">
  </a> </div>

<div ID=\"Pause\" NAME=\"Pause\" STYLE=\"Position: absolute; Left:305px; Top:316px;\">
  <script LANGUAGE=\"JavaScript\">
if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
    // Only include an HREF for Netscape -- IE stops playing when HREF click is detected
    document.write(\'<A HREF=\"java script:PauseNsPlayer()\"  onMouseOver=\"ButtonOver(\\\'Pause\\\')\" onMouseOut=\"ButtonOut(\\\'Pause\\\')\">\');
}
</script>
  <img Name=\"PauseBtn\" SRC=\"images/Pause_Off.gif\" BORDER=\"0\" OnClick=\"java script:PauseNsPlayer()\" onMouseOver=\"ButtonOver(\'Pause\')\" onMouseOut=\"ButtonOut(\'Pause\')\">
  <script LANGUAGE=\"JavaScript\">
if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
    document.write(\'</A>\');
}
</script>
</div>

<div ID=\"Play\" NAME=\"Play\" STYLE=\"Position: absolute; Left:275px; Top:346px;\">
  <script LANGUAGE=\"JavaScript\">
if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
    // Only include an HREF for Netscape -- IE stops playing when HREF click is detected (instead of restarting)
    document.write(\'<A HREF=\"java script:StartNsPlayer()\" onMouseOver=\"ButtonOver(\\\'Play\\\')\" onMouseOut=\"ButtonOut(\\\'Play\\\')\">\');
}
</script>
  <img Name=\"PlayBtn\" SRC=\"images/Play_On.gif\" BORDER=\"0\" onClick=\"StartNsPlayer()\" onMouseOver=\"ButtonOver(\'Play\')\" onMouseOut=\"ButtonOut(\'Play\')\">
  <script LANGUAGE=\"JavaScript\">
if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
    document.write(\'</A>\');
}
</script>
</div>

<div ID=\"Next\" NAME=\"Next\" STYLE=\"Position: absolute; Left:298px; Top:373px;\">
  <script LANGUAGE=\"JavaScript\">
if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
    // Only include an HREF for Netscape -- IE stops playing when HREF click is detected (instead of restarting)
    document.write(\'<A HREF=\"java script:Next()\" onMouseOver=\"ButtonOver(\\\'Next\\\')\" onMouseOut=\"ButtonOut(\\\'Next\\\')\">\');
}
</script>
  <img ID=\"NextBtn\" Name=\"NextBtn\" SRC=\"images/Next_Off.gif\" BORDER=\"0\" OnClick=\"java script:Next()\" onMouseOver=\"ButtonOver(\'Next\')\" onMouseOut=\"ButtonOut(\'Next\')\">
  <script LANGUAGE=\"JavaScript\">
if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
    document.write(\'</A>\');
}
</script>
</div>

<script LANGUAGE=\"JavaScript\">
function SetVol(iValue) {
    // Since Netscape and IE use different document object models, we\'ll
    // set up an Object named Player that points to the appropriate method
    var Player;
    if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
        Player = eval(\'document.PlayerDiv.document.NSPlay\');
    }else {Player = eval(\'document.all.NSPlay\');}
    ChangeVolume(Player, iValue);

    var VolImg;
    if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
        VolImg = eval(\'document.VolDiv.document.images.Volume\');
    }else {VolImg = eval(\'Volume\');}
   
    VolImg.src = \'images/Vol\' + iValue + \'.gif\';
}

function ChangeVolume(oObject, iValue) {
    var iNewVal = -600;            // Set to default value for NSPlay
    if (iValue == 1) iNewVal = -10000;
    if (iValue == 2) iNewVal = -1500;
    if (iValue == 3) iNewVal = -850;
    if (iValue == 4) iNewVal = -600;
    if (iValue == 5) iNewVal = -350;
    if (iValue == 6) iNewVal = -210;
    if (iValue == 7) iNewVal = -1;

    if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
        // Netscape plugin requires that we call a method
        oObject.SetVolume(iNewVal);
    } else {
        // In IE we set a property
        oObject.Volume = iNewVal;
        // Because our ImageMap has HREFs, we must retsart the player
        // Substituting OnClick would negate the need to restart, but
        // then Netscape wouldn\'t recognize our click events.
        oObject.Play();
        return(false);
    }
}
</script>
<!--    The following map uses HREFs to make Netscape happy. In an IE-Only    Environment Use OnClick instead. HREF pauses the player on each click    (at least, in IE), so you have to restart it in your script code.-->

<script LANGUAGE=\"JavaScript\">
<!--
if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
    // Include an HREF for Netscape  because it doesn\'t recognize OnClick
    // But if you use HREF for IE, the click event stops the player. So use OnClick instead
    document.write(\'<MAP NAME=\"VolControl\">\');
    document.write(\'<AREA SHAPE=\"circle\" COORDS=\"27,199,7\" OnClick=\"java script:SetVol(1)\">\');
    document.write(\'<AREA SHAPE=\"circle\" COORDS=\"27,175,7\" OnClick=\"java script:SetVol(2)\">\');
    document.write(\'<AREA SHAPE=\"circle\" COORDS=\"27,148,7\" OnClick=\"java script:SetVol(3)\">\');
    document.write(\'<AREA SHAPE=\"circle\" COORDS=\"27,124,7\" OnClick=\"java script:SetVol(4)\">\');
    document.write(\'<AREA SHAPE=\"circle\" COORDS=\"27,99,7\" OnClick=\"java script:SetVol(5)\">\');
    document.write(\'<AREA SHAPE=\"circle\" COORDS=\"22,74,7\" OnClick=\"java script:SetVol(6)\">\');
    document.write(\'<AREA SHAPE=\"circle\" COORDS=\"27,49,7\" OnClick=\"java script:SetVol(7)\">\');
    document.write(\'</MAP>\');
} else {
    document.write(\'<MAP NAME=\"VolControl\">\');
    document.write(\'<AREA SHAPE=\"circle\" COORDS=\"27,199,7\" OnClick=\"java script:SetVol(1)\">\');
    document.write(\'<AREA SHAPE=\"circle\" COORDS=\"27,175,7\" OnClick=\"java script:SetVol(2)\">\');
    document.write(\'<AREA SHAPE=\"circle\" COORDS=\"27,148,7\" OnClick=\"java script:SetVol(3)\">\');
    document.write(\'<AREA SHAPE=\"circle\" COORDS=\"27,124,7\" OnClick=\"java script:SetVol(4)\">\');
    document.write(\'<AREA SHAPE=\"circle\" COORDS=\"27,99,7\" OnClick=\"java script:SetVol(5)\">\');
    document.write(\'<AREA SHAPE=\"circle\" COORDS=\"22,74,7\" OnClick=\"java script:SetVol(6)\">\');
    document.write(\'<AREA SHAPE=\"circle\" COORDS=\"27,49,7\" OnClick=\"java script:SetVol(7)\">\');   
    document.write(\'</MAP>\');
}
//-->
</script>

<script LANGUAGE=\"JavaScript\">
<!--

if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
    document.writeln(\'<DIV ID=Clips NAME=Clips STYLE=\"FONT-SIZE: 10pt; color: Black; POSITION: absolute; LEFT: 520px; TOP: 25px; Z-INDEX: 10\">\');
    document.close();
} else {
    document.writeln(\'<DIV ID=Clips NAME=Clips STYLE=\"FONT-SIZE: 10pt; color: White; POSITION: absolute; LEFT: 520px; TOP: 25px; Z-INDEX: 10\">\');
    document.close();
}
//-->
</script>


<script LANGUAGE=\"JavaScript\">
<!--

    document.writeln(\'</DIV>\');
    document.close();
//-->
</script>

<div NAME=\"PlayerDiv\" BGCOLOR=\"darkblue\" STYLE=\"POSITION: absolute; z-index: 10; left: 41px; top: 30px; overflow: hidden; width: 256px; height: 240px\" id=\"PlayerDiv\">
  <!--    Lots of properties listed in the IE side of the object. There is no need to include    all of these, because each property has a default value. They\'re here for your reference.    Tip: Use the player in VB to see all properties and methods//-->
  <script LANGUAGE=\"JavaScript\">
// You must put entire object inside a document.write just to set the filename property
// Otherwise IE chokes. A better solution would be to use ASP code to set the filename
document.writeln(\'<OBJECT ID=NSPlay Name=NSPlay \');
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(\'    bgcolor=\"Black\" \');
document.writeln(\'    >\');
document.writeln(\'    <PARAM NAME=\"AudioStream\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"AutoSize\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"AutoStart\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"AnimationAtStart\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"AllowScan\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"AllowChangeDisplaySize\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"AutoRewind\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"Balance\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"BaseURL\" VALUE=\"\">\');
document.writeln(\'    <PARAM NAME=\"BufferingTime\" VALUE=\"5\">\');
document.writeln(\'    <PARAM NAME=\"CaptioningID\" VALUE=\"\">\');
document.writeln(\'    <PARAM NAME=\"ClickToPlay\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"CursorType\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"CurrentPosition\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"CurrentMarker\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"DefaultFrame\" VALUE=\"\">\');
document.writeln(\'    <PARAM NAME=\"DisplayBackColor\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"DisplayForeColor\" VALUE=\"16777215\">\');
document.writeln(\'    <PARAM NAME=\"DisplayMode\" VALUE=\"3\">\');
document.writeln(\'    <PARAM NAME=\"DisplaySize\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"Enabled\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"EnableContextMenu\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"EnablePositionControls\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"EnableFullScreenControls\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"EnableTracker\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"Filename\" VALUE=\"\' + sContentUrl + \'\"> \');
document.writeln(\'    <PARAM NAME=\"InvokeURLs\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"Language\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"Mute\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"PlayCount\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"PreviewMode\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"Rate\" VALUE=\"1\">\');
document.writeln(\'    <PARAM NAME=\"SAMILang\" VALUE=\"\">\');
document.writeln(\'    <PARAM NAME=\"SAMIStyle\" VALUE=\"\">\');
document.writeln(\'    <PARAM NAME=\"SAMIFileName\" VALUE=\"\">\');
document.writeln(\'    <PARAM NAME=\"SelectionStart\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"SelectionEnd\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"SendOpenStateChangeEvents\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"SendWarningEvents\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"SendErrorEvents\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"SendKeyboardEvents\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"SendMouseClickEvents\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"SendMouseMoveEvents\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"SendPlayStateChangeEvents\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"ShowCaptioning\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"ShowControls\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"ShowAudioControls\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"ShowDisplay\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"ShowGotoBar\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"ShowPositionControls\" VALUE=\"-1\">\');
document.writeln(\'    <PARAM NAME=\"ShowStatusBar\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"ShowTracker\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"TransparentAtStart\" VALUE=\"1\">\');
document.writeln(\'    <PARAM NAME=\"VideoBorderWidth\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"VideoBorderColor\" VALUE=\"Black\">\');
document.writeln(\'    <PARAM NAME=\"VideoBorder3D\" VALUE=\"0\">\');
document.writeln(\'    <PARAM NAME=\"Volume\" VALUE=\"-640\">\');
document.writeln(\'    <PARAM NAME=\"WindowlessVideo\" VALUE=\"-1\">\');

document.writeln(\'<EMBED type=\"application/x-mplayer2\" \');
document.writeln(\'    pluginspage=\"http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/\" \');
document.writeln(\'    id=NSPlay \');
document.writeln(\'    Name=\"NSPlay\" \');
document.writeln(\'  DisplaySize=\"0\"\');        // Fit To Size
document.writeln(\'  AutoSize=\"-1\"\');
document.writeln(\'  BgColor=\"Black\" \');
document.writeln(\'    ShowControls=\"-1\" \');
document.writeln(\'    ShowTracker=\"0\" \');
document.writeln(\'    ShowDisplay=\"0\" \');
document.writeln(\'    ShowStatusBar=\"-1\" \');
document.writeln(\'    VideoBorder3D=\"0\" \');
document.writeln(\'    width=208 \');
document.writeln(\'    Height=192 \');
document.writeln(\'  src=\"\' + sContentUrl + \'\" \');
document.writeln(\'  autostart=\"-1\" \');
document.writeln(\'  DESIGNTIMESP=\"5311\" \');
document.writeln(\'> \');
document.writeln(\'</EMBED> \');

document.writeln(\'</OBJECT>\');
document.close();
</script>
</div>

</body>
</html>

*********************************************

....jeg ved godt koden er lang - undskyld.

MVH Bambino

Avatar billede jakoba Nybegynder
27. februar 2001 - 00:26 #1
du kan lade dieverse javascript kontrolroutiner blive i den ramme der kører filmen og så kalde dem med:

parent.frames.ramme_navn.kontrol_routine();

hvor ramme_navn defineres i <FRAME taggen for den ramme der kører filmen:

  <frame name=\"ramme_navn\" ... >

på samme måde kan du hente variable og altmuligt andet.

mvh JakobA
Avatar billede jakoba Nybegynder
27. februar 2001 - 00:38 #2
prøv med at flytte next knappen først:

  <script LANGUAGE=\"JavaScript\">
var flm = document.frames.ramme_navn;  // så vi slipper for at skrive det hele hver gang
if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
    // Only include an HREF for Netscape -- IE stops playing when HREF click is detected (instead of restarting)
    document.write(\'<A HREF=\"java script:flm.Next()\" onMouseOver=\"flm.ButtonOver(\\\'Next\\\')\" onMouseOut=\"flm.ButtonOut(\\\'Next\\\')\">\');
}
</script>
  <img ID=\"NextBtn\" Name=\"NextBtn\" SRC=\"images/Next_Off.gif\" BORDER=\"0\" OnClick=\"java script:flm.Next()\" onMouseOver=\"flm.ButtonOver(\'Next\')\" onMouseOut=\"flm.ButtonOut(\'Next\')\">
  <script LANGUAGE=\"JavaScript\">
if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
    document.write(\'</A>\');
}
</script>

hvis du også flytter ButtonOut() og ButtonOver() til den anden ramme skal deres adressering ikke ændres.
Avatar billede bambino Nybegynder
28. februar 2001 - 20:35 #3
Tak for dine hurtige svar.

Umiddelbart kan jeg ikke få det til at virke hvis jeg placerer det med nextknappen i en frame jeg kalder \"bottom\" og ændrer ramme_navn til player (som er framen der afspiller filmen), får jeg følgende javascript fejl:

Error: \"flm\" is null or not an object

Desuden skal det helst ikke være knapper fra den eksisterende player javascipt-kode. Men blot være muligt ved tryk på et link, bookmark, hotspot eller andet at pause filmen. Det ønsker at kunne er at lade filmen pause hvis brugeren vælger surfe efter informationer eller surfe på andre sites - så skal filmen ikke bare køre i baggrunden - så mister bruger jo noget at oplevelsen.

Håber ikke jeg for krævende Jacob - på forhånd tak.
Avatar billede jakoba Nybegynder
28. februar 2001 - 21:31 #4
Nej da, det er jo faktisk nemmere :). Jeg troede du ville flytte alle kontrollerne.

Den fejl du fik kom af at jeg havde skrevet document.frames.ramme_navn Skulle have været parent.frames.ramme_navn (parent.frames.player)

skriv dette i rammen:

<div ID=\"Pause\" NAME=\"Pause\" STYLE=\"Position: absolute; Left:305px; Top:316px;\">
  <script LANGUAGE=\"JavaScript\">
if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
    // Only include an HREF for Netscape -- IE stops playing when HREF click is detected
    document.write(\'<A HREF=\"java script:parent.frames.player.PauseNsPlayer()\">\');
}
</script>
  <img Name=\"PauseBtn\" SRC=\"images/Pause_Off.gif\" BORDER=\"0\" OnClick=\"java script:parent.frames.player.PauseNsPlayer()\">
  <script LANGUAGE=\"JavaScript\">
if (navigator.userAgent.indexOf(\"IE\") == \"-1\") {
    document.write(\'</A>\');
}
</script>
</div>
Avatar billede bambino Nybegynder
28. februar 2001 - 21:45 #5
Hej igen.

Endnu en gang tak for hurtig svar. Det virker sådan set fint nok, men den kan kun pause første gang man trykker så reagerer den ikke længere. Er der nogen logisk årsag til dette?

Desuden (jeg ved godt jeg beder om meget) kunne det være interessant hvis man kunne bruge denne metode ifbm. flash ligeledes - altså når der klikkes i en anden frame for søge yderligere info - uanset om det er links, bookmarks, hotspot, flashlinks osv. osv. vil filmen pause og først fortsætte når brugeren vælger Play - er det muligt at lave et eller andet generelt stykke kode der gør at denne film pauses automatisk?

På forhånd tak igen..

MVH Bambino
Avatar billede jakoba Nybegynder
28. februar 2001 - 22:07 #6
Hvid den knap jeg kopierede virker som pause/unpause i playerrammen burde den virke ligesådan i den anden ramme.

hvis søgningen medfører load til en eksisterende ramme kan du evt lægge en onunload event i den rammes <body tag:
<body onunload=\"java script:parent.frames.player.PauseNsPlayer()\" ... >

eller en onblur= i \"player\"-rammen men den vil pause blot han klikker på nogetsomhelst andet end \"player\"-rammen:
<body onblur=\"java script:PauseNsPlayer()\" ... >
det er nok lovlig drastisk.

mvh JakobA

Avatar billede bambino Nybegynder
28. februar 2001 - 22:57 #7
Mange tak for hjælpen det giver mig en del at arbejde med - jeg tror den der kommer det nærmest er nok dit svar fra 28/02 2001 21:31:36 omkring et hvilket som helst link der pauser - desværre er det oprindelige script således at man skal trykke på Play for at starte filmen igen - så pausen knappen virker stadig kun en gang også selvom der trykker på play vha. mediaplayer-controls og så prøver knappen igen - ingen reaktion.

Hvis du får en rigtig smart måde at gøre dette på må du meget gerne kontakte mig på mko@proffice.dk.

På forhånd tak Jacob.

MVH Bambino
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester



IT-JOB

Acrelec Danmark

IT-supporter

Udviklings- og Forenklingsstyrelsen

Kollega med dataerfaring og analytiske evner

SEGES Innovation

DevOps med ambitioner