View Full Version : How do I register a callback?
abossy
June 11th, 2009, 01:56 AM
I'm writing an application in Boxee in which I'd like to play a new video after the current one finished. It looks like I can access the "EVENT_ENDED" player event as follows:
mc.GetPlayer().GetLastPlayerEvent() == EVENT_ENDED
...yet, this code can only be executed in the context of a UI event, like "onclick."
Is there any way to run a daemon thread to check for the occurrence of these event? Pandora does it, yet I've pored over the app's source code, and I'm baffled as to how it's done.
idan
June 11th, 2009, 03:57 AM
what you should do is create a playlist from the videos, thus enabling boxee to play them one after the other and users can skip between them.
example:
n = mc.GetWindow(14000).GetList(111).GetFocusedItem()
items = mc.GetWindow(14000).GetList(111).GetItems()
if mc.GetPlayer().IsPlaying():
mc.GetPlayer().Stop()
playlist = mc.PlayList( mc.PlayList.PLAYLIST_VIDEO )
playlist.Clear()
for item in items:
playlist.Add(item)
mc.GetPlayer().PlaySelected( n, mc.PlayList.PLAYLIST_VIDEO )
abossy
June 12th, 2009, 08:05 PM
Thank you for the very prompt response, idan.
I have implemented this and it works, except for the controls in the video player. The only button that works is the stop button, which doesn't actually stop the video, but moves to the next one in the playlist. Ideally, this would occur when the right triple arrow is pressed, and play/pause/ffwd/rwd would work normally.
EDIT: The slider doesn't work, either. The videos I'm playing are from YouTube and I'm using ListItem.setPath("http://www.youtube.com/watch?v=<video_id>") to play them.
EDIT 2: The YouTube page flickers before the video loads. This looks awful. :( Most of this app is based on the Kutiman demo, which circumvents this, somehow, although the controls don't work for that one, either. The native YouTube app run the most smoothly.
Powered by vBulletin® Version 4.1.12 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.