View Full Version : Play video on button click
Sniperking
May 19th, 2009, 12:53 PM
Hey Guys
I only recently started looking into boxee apps and currently i am at a stand still. What i want to know is, is it possible to play an online video (http://, flash://) using the onclick event of a button? If so how would i do this as i cannot figure it out. If it isnt possible how would i do it?
Thanks
DPK
May 19th, 2009, 01:39 PM
Check out the Player class:
http://developer.boxee.tv/python-api-reference/#Player
Specifically Player.Play(ListItem item) where you could set the whole thing up with a button onclick.
Sniperking
May 19th, 2009, 01:52 PM
Hey
Thanks for the reply,though being new im still not 100% what i need to type.
Curently im trying
<onclick lang="python"><![CDATA[
mc.GetPlayer().Play(with flash:// link in here)
]]></onclick>
is that completely wrong.
Im just trying to get a skin file with a button that says "Play" etc and then the media player starts playing the flash file.
I cant test player.play() currently as im not on ubuntu.
Thanks
ameno
May 19th, 2009, 02:14 PM
If you don't need to do specific actions before you play the video, just load up a list and set its path to whatever your Boxee-formatted RSS feed is. The default onclick action for the list items is to play them in the player. If you do want to take actions in python before you play, check the forum for my post on the subject of list items to get the code you need to guarantee compatibility.
Sniperking
May 19th, 2009, 02:26 PM
If you don't need to do specific actions before you play the video, just load up a list and set its path to whatever your Boxee-formatted RSS feed is. The default onclick action for the list items is to play them in the player. If you do want to take actions in python before you play, check the forum for my post on the subject of list items to get the code you need to guarantee compatibility.
Hey
I havent actually used lists yet so im going to need an example.Iv only been using the boxee api for about a week and had no coding experience before hand so i apologies if i seem like a noob. The link is to a flash video btw not an rss feed if that changes anything.
Thanks
Sniperking
May 21st, 2009, 04:08 PM
Bump
Still need help guys
ameno
May 21st, 2009, 07:18 PM
Start by building the demo app in the documentation. Just remove the onclick python.
Sniperking
May 22nd, 2009, 07:14 AM
Start by building the demo app in the documentation. Just remove the onclick python.
Does this apply to flash:// feeds too? as that is what i am trying to make. Ill try what you have said.
Thanks
idan
May 24th, 2009, 12:28 PM
hey,
whatever you use, you always have to supply a listitem to the player. that was made to work this way so boxee will be able to show information on the playing item and send the info along the social network.
you can use flash:// but what you have to do is
listitem = mc.ListItem( mc.ListItem.MEDIA_VIDEO_CLIP )
listitem.SetLabel( "whatever" )
listitem.SetThumbnail( "http://www.somthing.com/somethingelse.png" )
listitem.SetPath( "flash://.." )
mc.GetPlayer().Play( listitem )
please let me know if that works or you need anymore help,
idan
Sniperking
May 24th, 2009, 04:29 PM
Hey Idan
That did turn out to be the correct way to do it. I found out from the other thread you posted in http://forum.boxee.tv/showthread.php?t=8971.
This is what i have now
<onclick lang="python"><![CDATA[
listitem = mc.ListItem()
listitem.SetPath("flash:" )
mc.Player().Play(listitem)
]]></onclick>
Is there any advantage of adding the extra code which you have writen?
listitem = mc.ListItem( mc.ListItem.MEDIA_VIDEO_CLIP )
listitem.SetLabel( "whatever" )
listitem.SetThumbnail( "http://www.somthing.com/somethingelse.png" )
Also is player.play and getplayer.play the same thing?
Thanks for your help.
Powered by vBulletin® Version 4.1.12 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.