Avatar billede fredand Forsker
29. marts 2001 - 12:01 Der er 1 kommentar og
1 løsning

Wait for wav file to get downloaded!

Hello!

Found your excelent site at last!

I have some problemo with Mediaplayer play wav files.

Problemo 1)
I have to wait for a file being downloaded complete before playing it.

Problemeo 2)
When I\'m playing it I should be able to stop it.

My code so for is:
var s2Flag = false;

function s2PlayOrStop()
{
   
    if(!s2Flag)
    {
        //if(Need som code to check if it is downloaded complete)
        //{
            s2.play();
        //}
    }
    else
    {
        s2Stop();
    }
}

function s2Play()
{
    s2.play();
}

function s2Stop()
{
    s2.stop();
}

window.document.all.b2.onclick = s2PlayOrStop;

So far I can start the sound (s2) by clicking the button (b2), but I can\'t stop it while playing.

really hope you can help me with this!

Best regards
Fredrik Andersson



 
Avatar billede nikolajdu Nybegynder
29. marts 2001 - 13:39 #1
1. You cannot check whether a download is complete or not. MediaPlayer will alyways start before download is complete. If you run it streaming you could use this for a kind of check onthe buffer process.

if (co_MediaPlayer.BufferingProgress <= 70){
var statusValue = \"buffering: \" + co_MediaPlayer.BufferingProgress + \"%\";
}else{
var statusValue = \"sune s : \" + formatDuration(co_MediaPlayer.CurrentPosition)
}

2. Mediaplayer

function mp_Stop(){
s2.Stop();
s2.CurrentPosition = 0;
}
Avatar billede nikolajdu Nybegynder
29. marts 2001 - 13:59 #2
Of course you have to put change the names in my example to the names of your mediaplayer. E.g. s2.BufferingProgress.

Anyway, Welcome to www.eksperten.dk

You don´t have to accept any answers before you it works and you are satisfied.

Faces of the Experts. http://www.fotx.net/nikolajdu

/Nikolaj
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