player - strange Video behaviour before stop

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
JamesWebster
Posts: 25
Joined: Sun Aug 07, 2011 11:36 am

player - strange Video behaviour before stop

Post by JamesWebster » Sun Oct 28, 2012 12:38 pm

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: player - strange Video behaviour before stop

Post by Mark » Tue Nov 13, 2012 4:42 am

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Klaus
Posts: 14193
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: player - strange Video behaviour before stop

Post by Klaus » Tue Nov 13, 2012 11:10 am

Hi James,

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


Best

Klaus

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: player - strange Video behaviour before stop

Post by Mark » Tue Nov 13, 2012 11:46 am

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Klaus
Posts: 14193
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: player - strange Video behaviour before stop

Post by Klaus » Tue Nov 13, 2012 11:58 am

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

Post Reply