Home > Archive (Community help, from old helpdesk) > When Click Play and quickly Click Stop, will let the media player throw exception!

When Click Play and quickly Click Stop, will let the media player throw exception!

Avatar image
Aug 23, 2015
Archive Agent wrote
the operation step like :http://support.visioforge.com/forums/172855-community-help/suggestions/3992349-when-click-play-and-quickly-click-pause-will-let-

please see the picture.

picture.jpg 37 KB - 146 downloads
qakmak on May 24, 2013 10:18
Completed
0
Vote
Reply
13 Answers
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

Don't do it. Check Status property if required. Do not try to Stop and Play at the same time, you can have unexpected behaviour.

on May 27, 2013 19:47
Aug 23, 2015
Archive Agent agent wrote
qakmak

but as you know. user I can't control.....so I don't know how can I do . Is there any property I can know the Media player is busy now??(I think add a property by own before, but I don't know Media Player current state busy or not. so my property too. For a example: there is a button for play Next Movie. and when use click it:
if (MediaPlayer1.States == VFMediaPlayerStatus.Play)
MediaPlayer1.Stop();//stop first if player is playing.
NextMovie();//then play next movie;

when user click the next movies button ,and next movies not begin , user continue click the next movie button again, Media player will be throw exception. I think if you add a bust play state , I can do this.

if (MediaPlayer1.Status == VFMediaPlayerStatus.Busy)
return;// if media player is busy , ignore this operation.
//and continue play next movies.

if you want me add property by owe, when I use MediaPlayer.Play() and gonna change the propery statue, but Media Player not finish play yet. so not helpful.
).

so I need use some property know Media Player is busy know ,and if it is, I can let the every operate invalid in this time.

just like every time before I'm stop(); check it.like: next song. stop. replay.

if (MediaPlayer1.Status == VFMediaPlayerStatus.Busy)
return;

and how are you think?

on May 28, 2013 07:39
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

Yes, check Status, if not free - than busy.

on May 28, 2013 14:22
Aug 23, 2015
Archive Agent agent wrote
qakmak

what??
I mean....What??

now sdk only have 3 status. pause, play , free. there is no any busy status. that's why I'm say it to you....

I already check status. but I only can check this:

if (PlayState == Enum.PlayState.Play || PlayState == Enum.PlayState.Pause)
Stop();
PlayNextMovies();

but if user click twice in one time. media player will be crash. because first click media player is Play(); but I don't know inside ,maybe not init complete yet.

on May 28, 2013 15:01
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

Is it connected with OnStop problem on independent button used to go to the next file?

on May 28, 2013 21:25
Aug 23, 2015
Archive Agent agent wrote
qakmak

no, I'm just test it. and I cancel the OnStop event. same result.
the problem is MediaPlayer1.Stop(). just like the picture. when I'm click next movies or replay current movies. I need check Media Player status and it's playing. and I need stop first. and play.
if user quickly click the button twice. because Media Player just now begin playing. and may be not finish the play. but the media status is : Playing(there is not have busy status). so app need stop it first. and when it stop. the exception will be throw.

on May 28, 2013 21:51
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

Yes, you must stop it first, before second file playback started. Ticket is closed.

on June 04, 2013 19:09
Aug 23, 2015
Archive Agent agent wrote
qakmak

You kidding?? I'm already told you that's not what I can control. It's about customer. about the final user . If those people click quickly let this happening . What can I do?????? you need fixed it or give me a solution. because I don't know when the sdk not "going play, but not play finish", like busy mode

on June 05, 2013 11:07
Aug 23, 2015
Archive Agent agent wrote
qakmak

and I don't understand what is mean you said:"Yes, you must stop it first, before second file playback started. ".

I already said. I always stop it first . so. what is that mean??

the problem is if someone play movies. and there is have a button "play Next", use can use it play next movies. but if user Intentionally or unintentionally double click the button "play next". so the problem is happening what I'm talking about.

I always check it if state is play, stop first. but when use double click or quickly click twice. it will be stop first. and play , and stop, and play. the problem is the second stop. because the first play not Initialization all I think. so you need to check it , not close the ticket and told me don't continue close ticket. Why I will continue the close ticket?? because problem not resolved. not any other reason.

on June 05, 2013 11:21
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

Add flag to mark that playback started for example. Call Stop always.

on June 05, 2013 15:57
Aug 23, 2015
Archive Agent agent wrote
qakmak

the problem just happening when I'm Stop(). because Play() just begin, and I stop it . will be this problem happening. let me use a simple way tell you. when user quickly click PlayNext button. this is happing:

1.MediaPlayer1.Stop();//because it's playing now.
2.MediaPlayer1.Play();//program auto changed next movie playback and play it;
3.MediaPlayer1.Stop();//because user click twice, so that stop again(This is a problem source)
4.MediaPlayer1.Play();//that code not execute, because Stop() is throw a exception.

you wan't me add flag. but I already check the play status, and No3 status is playing, so I stop. and problem happening. So that's not about my flag. about your api.

can you understand this now?

on June 05, 2013 19:22
Aug 23, 2015
Archive Agent agent wrote
qakmak

and the Replay can possible happening this problem.

on June 07, 2013 12:19
Aug 23, 2015
Archive Agent agent wrote
Roman Minyaylov

Ok, will be fixed in next build.

on June 30, 2013 13:04