Xbmc.player question
#1
how do you write a script that does stuff immediately after xbmc.player() stops playing?
if i put commands after the xbmc.player()play command, they just run immediately, even while the player is still playing. can i make scripts pause while the player is playing, or do i have to somehow capture the state of the player, so i know when it has stopped? how would i do that?

thanks

john
Reply
#2
you have to extend the player() class and define the onplaybackended method or something like that. its similar to how you extend the window and add an onaction() method. then you have to use that player instead of the xbmc.player.

check out the xbmc module doc (its in a sticky) for specifics.
Reply
#3
thanks for the tip. i'll give it a try. i'm new to all this and so i don't know where to find the sticky you refer to. where is it?

john
Reply
#4
i think the method onplaybackended() does not work.
maybe team can tell us what is true... (it should work but not for all video files)

maybe you can do this trick :
create a thread class, this one will launch the player and then loop on a time.sleep(1) and test : player.isplaying() or something like that. when player.isplaying is false, set a flag to tell your script it can go on ...
Reply
#5
(solexalex @ jan. 26 2005,16:46 Wrote:i think the method onplaybackended() does not work.
maybe team can tell us what is true... (it should work but not for all video files)
yeah i havent had to extend the player class before so cant vouch for it. i remember some script out there did though... was it the webmediabrowser?
Reply
#6
i think i remember that onplaybackended() works for some but not all media files...
Reply
#7
onplaybackended() is called when xbmc reaches the end of file and stops playing.

onplaybackstopped() is called when the user stops playback of a file.

with both of those functions, you should be able to execute code whenever a media file stops playing (if file playback was started from python).
Reply
#8
is these theorical ? or practical ?
because , i don't know if it has been fixed, but these functions to find the end where not very functionnal for all file types....
Reply
#9
well, i've only been using those functions with video files... but i recently added the onplaybackstopped() method to xbmc and i didn't put file type specific code before calling the method in your python objects. i agree it might have looked like the functions did not always work when only onplaybackended() existed... that function is only called when xbmc finishes playing the *entire* file. that is why i added onplaybackstopped().
Reply

Logout Mark Read Team Forum Stats Members Help
Xbmc.player question0