views:

62

answers:

0

I have the below in a .js file that runs when I start playing a .wav file - to check for when media player has finished playing the file - and it worked before I added the Player (object id="NSPlay") etc, to an AJAX update pannel.

Anyone with some suggestion on what I need to do to detect when it has finished playing the .wav file and so redirect?

function checkPlayState(checkStatus) {
    alert("testing") // even this is not poping up for me

    var Player = document.getElementById("NSPlay");
    if (Player.playState == 0 || Player.playState == 1) {       //  0 vs 8 
        if (checkStatus == true) {
            var tex_t = document.getElementById("ctl00_ContentPlaceHolder1_TextArea1").innerHTML;
            window.location.href = 'Speach.aspx?T=' + tex_t;

            return;
        } else {
            window.setTimeout("checkPlayState(true)", 500);    
        }
    } else {
        window.setTimeout("checkPlayState(false)", 500);
    }
}

Am using this to call the .js file and as above I have added the alert("testing") bit to the above and even that is not poping up for me, so I think this is where the problem is:

Page.ClientScript.RegisterClientScriptInclude("selective", ResolveUrl("check_playing.js"))
If (Not Master.Page.ClientScript.IsStartupScriptRegistered("check_playing")) Then
    Master.Page.ClientScript.RegisterStartupScript(Me.GetType(), "check_playing", "checkPlayState(false);", True)
End If

Thinking ScriptManager (mine is empty) sounds like a good bet also, but don't know as I'm just a hobbyist..................