Page 1 of 1

player - strange Video behaviour before stop

Posted: Sun Oct 28, 2012 12:38 pm
by JamesWebster
Hi everyone!,
I encountered a problem with the player object. When I try to play a Video, it plays fine till it is almost finished. Then the Video freezes like half a second before it is supposed to end and then skips right to the end. I tried to mask the player with a graphic "rectangle" (in the "on playstopped" function) already, but this didn't work either. I think it has something to do with the "On playstopped" function. Can anybody help me with this problem? I`m using Livecode Version 4.6.1, thank you for your help in advance! I attached the code I'm using.

best regards,
James Webster

Code: Select all

On opencard
   local filepath
      put specialFolderPath("desktop") & "/Urteil/Video_1.mp4" into filepath
      set the filename of player "Videos" to (filepath)
      start player "Videos"
end opencard

On Playstopped
   lock screen
   set the filename of player "Videos" to empty
   unlock screen
end playstopped

Re: player - strange Video behaviour before stop

Posted: Tue Nov 13, 2012 4:42 am
by Mark
Hi James,

Does it help if you set the alwaysBuffer of the player control to true?

Why locking the screen and why masking? Have you tried it without locking the screen? Why even setting the filename of the player control to empty? What is it that you are trying to achieve by this?

You could execute the following in the message box:

Code: Select all

set the callbacks of player 1 to (the duration of player 1 & comma & "player1CallbackMsg"
and replace the playStopped handler with

Code: Select all

on player1CallbackMsg
     set the filename of player "Videos" to empty
end player1CallbackMsg
Best regards,

Mark

Re: player - strange Video behaviour before stop

Posted: Tue Nov 13, 2012 11:10 am
by Klaus
Hi James,

does it play fine if you comment out the "playstpped" handler?


Best

Klaus

Re: player - strange Video behaviour before stop

Posted: Tue Nov 13, 2012 11:46 am
by Mark
Hi Klaus,

I think it does, because he says he believes it has something to do with the playStopped handler. I presume he did a test without this handler.

Kind regards,

Mark

Re: player - strange Video behaviour before stop

Posted: Tue Nov 13, 2012 11:58 am
by Klaus
Hi Mark,

ah, OK, believing and scritping/programming does not fit too well together, so I just wanted to be sure :D

James, try this:

Code: Select all

On Playstopped
   lock screen
   lock messages
   ## PLAYSTOPPED will also be sent when you set the FILENAME to a new file or to empty!
   ## maybe this will help...?
   set the filename of player "Videos" to empty
   unlock screen
   unlock messages
end playstopped
Does not make any sense, but what the heck, its worth a try!? :D


Best

Klaus