What is the best way to check to see if a video is still playing (.swf loaded dynamically) without captivating the processor – we have many videos
thanks
What is the best way to check to see if a video is still playing (.swf loaded dynamically) without captivating the processor – we have many videos
thanks
i’m no video expert but the only way i can think of to do it is to convert your video to swf files and then check against the frame length of the symbol or swf file that you’ve loaded
MX has an excellent video compressor so i think that’s what i would do.
i hope this helps
Howdy…
I guess you are loading the external SWF file into the empty movieclip, right??? You can constantly check if yourHolderMC._currentframe value is changing, meaning playing, or if that equals to yourHolderMC._totalframes, meaning the play head is at the end frame…
Did this help you??? Let me know… =)
well… more info
The video .swfs are loaded dynamically. In some cases I am just playing a segment of the video file.
I worry about using any solution that constantly is check for completion of the file because I am honestly concerned that it will become a processor nighmare…
What I was thinking of was in the external file putting
isPlaying = True in the first frame and isPlaying = False in the last frame and then building the if/else statement around this…any thoughts??
Yes… That can be done too… As a matter of fact, I’ve done the exactly same thing that you have mentioned long time ago… But then, I had just a couple of MP3s in that SWF files which I need to put the code in the beginning and ending frame… But then, if you have several hundred… What are you going to do??? That’s why I have mentioned you to check the properties…
Now… When do you have to check if the video/audio is playing??? Do you need to constantly check it or just at a certain point when some button is pressed??? If it is the former case, you don’t have any other choice but to check it with the looping which will bog down the CPU power… If it is the latter, then just check that condition one time when the button is pressed… I guess you will have to figure out when to check it and how to check it based on the efficiency… =)
duh…that’s acutally less work…
how do I code:
yourHolderMC._currentframe value is changing
if(tvScreen_mc._currentframe == ?){
}
Well… Assuming that you are checking it constantly and supposing that your video/audio will be playing only once…
_level0.onEnterFrame = function ()
{
if(tvScreen_mc._currentframe == tvScreen_mc._totoalframes)
{
trace("Finished playing");
delete _level0.onEnterFrame;
}
else
{
trace("Still playing " + tvScreen_mc._currentframe);
}
}
Something like this should be the one you are trying to achieve… Let me know how it works for you…
PS>> Please don’t PM me… I DO track the thread… :cowboy:
thank you for writing… sorry about the pm :0( got it…
ok… i understand everything but “Finished playing” and “Still playing”… do i need to do anything else in my setup to make these work… are they variables…and if so where do they go?
Also, here’s the important thing to me…the user will be able to push operator control buttons - there are two of them … they can select these in any order and that plays a video and counts a variable… after the varible get to > 2 is when the final video is played but this is where the “isPlaying” comes in as I need to know when the video that preceeds the final video has completed its turn…please keep talking to me if this doesn’t make sense… I have told the PM that it is most likely not a good idea to keep checking to see if video is done under these circumstances but she wants it this way… i just need to make it work…
thank you for writing… sorry about the pm :0( got it…
No problem… =)
ok… i understand everything but “Finished playing” and “Still playing”…
I just put that trace() functions to visually show you the result in the output panel… You can erase those lines and add your own action…
do i need to do anything else in my setup to make these work…
It all depends on how you program it I guess… What do you need to do when the video is done playing???
are they variables…and if so where do they go?
They are not the variables… trace() function prints out whatever is in the parenthesis… The script that I have provided may be placed in the frame where you load/start the movie file that you want to check if it is playing or not…
Also, here’s the important thing to me…the user will be able to push operator control buttons - there are two of them … they can select these in any order and that plays a video and counts a variable… after the varible get to > 2 is when the final video is played but this is where the “isPlaying” comes in as I need to know when the video that preceeds the final video has completed its turn…
So, basically there could be a video playing and you need to check if that video ended or not, and if it has ended, you can start the final video??? If that is the case, trace(“Finished playing”);, will be the one where you should have your movieclip to load the final video…
it is most likely not a good idea to keep checking to see if video is done under these circumstances but she wants it this way… i just need to make it work…
You don’t really have other choice but to check it constantly if this is the case… I think… =)
whew… you are so kind… thank you…
so in the code where
{
trace(“Finished Playing”);
}
appears – this is where I would insert the code to load the final video and play it?
I also have code that checks the buttons to see if the buttons have each been clicked once… and when the user has selected both buttons in random order (to see the videos) and the varible for this scenario >2 …that’s when the last video has been played… looks like i will need to check each video in the sequence to see if they have completely played…although they are short segments and it is running fine … i will try it…
Yes… That’s the place where the code should be…
Try that and let me know how it goes… =)
:: Copyright KIRUPA 2024 //--