Firefox change video from onchange javascript

Discussion in 'Javascript' started by richardscheff@gmail.com, Jun 4, 2006.

  1. Guest

    Video selector works for IE but not other browsers.

    for not IE

    <object ID='Player' data="video/dodgeball.wmv" type="video/x-ms-wmv"
    width="320" height="280">
    <param name="filename" value="video/dodgeball.wmv" />
    <param name="ShowControls\" value="1" />
    <param name="AutoStart\" value="1" />
    <param name="PlayCount\" value="1" />
    </object>";

    for IE
    <Object ID='Player' width=320 height=280
    ClassID='CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95'Type='applicaton/x-oleobject'><Embed
    Type ='application/x-mplayer2'Src='null.wvx'Name='Player'
    showtracker='-1' showcontrols='true' autostart='true' showdisplay='0'
    showstatusbar='-1'</Embed></Object>


    In javascript I do this.
    function PlayVideo(fName){

    document.Player.filename = fName;
    document.Player.data = fName;
    document.Player.play();
    }

    function GetSelection (selSelectObject){
    data =
    selSelectObject.options[selSelectObject.selectedIndex].getAttribute('value');

    //data = selSelectObject.options[selSelectObject.selectedIndex].value;
    PlayVideo(data);
    }


    <SELECT name=VideoList onchange="GetSelection(this)"
    onkeydown="window.setTimeout(function(e0){return function()
    {GetSelection(e0)}}(this),0)" >
    <option selected value=null>Choose A Video</option>
    .. . . . .
    </select>
     
    , Jun 4, 2006
    #1
    1. Advertising

  2. cwdjrxyz Guest

    wrote:
    > Video selector works for IE but not other browsers.
    >
    > for not IE
    >
    > <object ID='Player' data="video/dodgeball.wmv" type="video/x-ms-wmv"
    > width="320" height="280">
    > <param name="filename" value="video/dodgeball.wmv" />
    > <param name="ShowControls\" value="1" />
    > <param name="AutoStart\" value="1" />
    > <param name="PlayCount\" value="1" />
    > </object>";
    >
    > for IE
    > <Object ID='Player' width=320 height=280
    > ClassID='CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95'Type='applicaton/x-oleobject'><Embed
    > Type ='application/x-mplayer2'Src='null.wvx'Name='Player'
    > showtracker='-1' showcontrols='true' autostart='true' showdisplay='0'
    > showstatusbar='-1'</Embed></Object>
    >
    >
    > In javascript I do this.
    > function PlayVideo(fName){
    >
    > document.Player.filename = fName;
    > document.Player.data = fName;
    > document.Player.play();
    > }
    >
    > function GetSelection (selSelectObject){
    > data =
    > selSelectObject.options[selSelectObject.selectedIndex].getAttribute('value');
    >
    > //data = selSelectObject.options[selSelectObject.selectedIndex].value;
    > PlayVideo(data);
    > }
    >
    >
    > <SELECT name=VideoList onchange="GetSelection(this)"
    > onkeydown="window.setTimeout(function(e0){return function()
    > {GetSelection(e0)}}(this),0)" >
    > <option selected value=null>Choose A Video</option>
    > . . . . .
    > </select>


    For starters, you have a problem with your objects for the WMP. The one
    labeled as for IE actually is an ActiveX object for the WMP for the IE
    with an embed path within it for non-IE browsers. If you use the code
    you have here, and it is correct, you do not need the not IE object,
    and it well could be causing a conflict. Although the ActiveX object
    with the embed path often is used and will work, it is not proper
    modern html where embed is not an official W3C tag and never has been.

    I will repeat part of my answer to another thread concerning the WMP
    and Firefox below, as it shows that only a single object using valid
    code will serve for most common recent browsers.
    If at all possible, avoid trying to control the WMP with script.
    First,
    embed has never been an official tag, and object is the modern method.
    Of course many sites still use tag soup with an ActiveX object for IE
    and an embed path within the AE object for most other browsers that do
    not support AE. You will find the W3C validator does not like this soup
    or use of a simple embed tag.

    The WMP has many controls built in that can be specified in a correct
    object tag, so it usually is not necessary to make your own controls
    using script or whatever.

    Go to a page of mine at
    http://www.cwdjr.info/broadbandMedia/formatsOB/cancanWMV.php and look
    at the object code that inserts the WMP with controls. This video uses
    a very high variable bit rate wmv video file, so it may not stream on
    dialup without an extremely long buffering time. The average bit rate
    is about 1919 kbps. You will notice that the object for the video calls
    for a .wvx file which is a redirector file; the actual video file is a
    ..wmv file. The .wvx file has a simple XML structure that points to the
    ..wmv file, and the one used in this example is:

    <ASX VERSION="3.0">
    <ENTRY>
    <REF HREF="http://www.cwdjr.info/movie/CanCanvbr.wmv" />
    </ENTRY>
    </ASX>

    On broadband, that will allow about 2.5 Mbps, buffering of the above
    sample is quite fast, and you can click on the video shortly when
    buffering is completed. For good dialup, you would need a video
    recorded at not more than about 30 kbps, and the image would need to be
    kept quite small. Even so, streaming video leaves much to be desired on
    dialup. My example works on most recent popular browsers with the WMP
    installed including IE6, Opera, and the Mozilla family(Firefox,
    Mozilla, Netscape).

    If you absolutely must use script to control the WMP, there used to be
    some information somewhere on the Microsoft developers sites. However,
    if I remember correctly, some of the uses of script discussed there
    used Microsoft Jscript, some examples were designed to work on ActiveX
    objects that often are not supported by non-IE browsers, and some
    scripts to detect the WMP and version used vb script that does not work
    on many non-IE browsers. One likely could spend days at Microsoft
    developer sites finding scripts and testing, and often changing them
    for non-IE browsers.

    I have used code to make a menu of about 20 audio selections down the
    right side of a page. I used a document.write in a loop to write an
    object for the WMP for each player so you do not have to write so much
    by hand. The size of the player was kept small so that each player was
    just a small on-off selection button generated by the WMP. Of course
    this would have to be modified for video because the video object
    requires a fairly large area, and you would not want to string 20 large
    players with controls down the right of the page.
     
    cwdjrxyz, Jun 4, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    483
    Travis Newbury
    Feb 8, 2006
  2. Bruno Alexandre

    OnChange Javascript - IE vs Firefox

    Bruno Alexandre, Jun 12, 2006, in forum: ASP .Net
    Replies:
    7
    Views:
    42,882
    Greg Collins [Microsoft MVP]
    Jun 12, 2006
  3. wallge
    Replies:
    8
    Views:
    711
    wallge
    Jan 12, 2007
  4. David McNerney
    Replies:
    4
    Views:
    182
    David McNerney
    Apr 7, 2006
  5. Replies:
    5
    Views:
    171
    ibizara
    Nov 26, 2007
Loading...

Share This Page