Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: Helper2 API Reference

  1. #1

    Default Helper2 API Reference

    WORK IN PROGRESS!

    I'm attempting to document the helper2 boxee browser api because there isn't one. Many people have requested it as of late so bear with me while I keep adding to this and clean it up.

    This is nowhere near finished at all as I've only combed through a few files and there's more stuff I have to post regarding actually using any of this, lol. I'm attempting to test certain aspects of it while I'm doing this so it's taking a bit to process it all mentally.

    Basically just bear with me and this will be moderately sane by the end of the day.


    http://wiki.boxee.tv/JavaScript_API

    Sample API entry:
    http://wiki.boxee.tv/GetVersion
    Last edited by DPK; September 24th, 2009 at 08:27 AM.
    Common issues w/ Boxee:
    Beta Important Info | FAQ & Support Requests | Hulu Mature Content | Search

    UnBoxeed app development:
    Comics.com | ESPN360 | Weather

    For more info, follow app development on Twitter!

  2. #2

    Default

    Awesome. Really cool. I sadely have to be in school all day but I will mess with it when I get home.

    Look for my apps in the main boxee repository. A list of currently available apps is on my website.

  3. #3

    Default

    Almost have helper2 working for The Weather Channel. I'll post my code soon.
    Common issues w/ Boxee:
    Beta Important Info | FAQ & Support Requests | Hulu Mature Content | Search

    UnBoxeed app development:
    Comics.com | ESPN360 | Weather

    For more info, follow app development on Twitter!

  4. #4

    Default

    Alright, here's my code for weather.com and my Weather Channel app. It's a pretty straight forward controller file and it works with the current video media feed I'm pushing out for the app. For right now until team boxee adds it to the official helper2 directory, just drop the below code in a file called weather.js and save it to the /boxee/system/players/flashplayer directory. Note this is the boxee directory where the boxee executable is and not where your userdata is.

    The controller basically polls the player window every 500ms for visual changes (using getPixel). It first verifies that the media is loaded and ads are no longer playing. When that happens the video window is maximized full screen. Polling continues until the player window is detected as being in a stopped state momentarily. As soon as that happens a notifier is sent to axe the player window.

    Let me know if you have any questions at all as I'm getting pretty good at understanding what all the javascript does at this point. I tried to comment some of the stuff, but everyone reads things differently.

    Code:
    // config options
    boxee.autoChoosePlayer = true;
    boxee.renderBrowser    = false;
    
    boxee.enableLog(true);
    boxee.setCanPause(false);
    boxee.setCanSkip(false);
    boxee.setCanSetVolume(false);
    
    var isPlaying = false;
    
    
    /* func: R/G/B
     * desc: used for converting pixel colors to RGB
     */
    function R(p) { return (p & 0x00ff0000) >> 16; }
    function G(p) { return (p & 0x0000ff00) >> 8; }
    function B(p) { return (p & 0x000000ff) ; }
    
    
    /* func: poll
     * desc: continuously monitors the player status
     */
    function poll() {
    	if (isLoaded() && isStopped()) {
    		boxee.notifyPlaybackEnded();
    	}
    	else if (isLoaded() && (isPlaying == false)) {
    		boxee.getActiveWidget().click(387, 457);
    		isPlaying = true;
    	}
    }
    setInterval(poll, 500);
    
    
    /* func: getProgress
     * desc: monitors the progress bar on the player, but
     *       deprecated due to inability to monitor progress
     *		 when player is maximized to full screen status
    function getProgress() {
    	if (!isLoaded()) {
    		return -1;
    	}
    	
    	var i = 0.0;
    	for (x=75; x<435; x+=5) {
    		p = boxee.getActiveWidget().getPixel(x, 434);
    		
    		if ((r >= 160) && (r <= 200)) break;
    		if ((g >= 160) && (g <= 200)) break;
    		if ((b >= 160) && (b <= 200)) break;
    		
    		i+=5;
    	}
    	return Math.round((i/360)*100);
    }
    */
    
    
    /* func: isLoaded
     * desc: media is loaded and ads are not playing
     */
    function isLoaded() {
    	p = boxee.getActiveWidget().getPixel(172, 455);
    	
    	b = B(p);
    	g = G(p);
    	r = R(p);
    	
    	if ((r >= 160) || (r <= 70)) return false;
    	if ((g >= 160) || (g <= 70)) return false;
    	if ((b >= 160) || (b <= 70)) return false;
    	
    	return true;
    }
    
    
    /* func: isStopped
     * desc: media has stopped playing
     */
    function isStopped() {
    	p = boxee.getActiveWidget().getPixel(255, 220);
    	
    	b = B(p);
    	g = G(p);
    	r = R(p);
    	
    	if ((r <= 20) || (r >= 100)) return false;
    	if ((g <= 20) || (g >= 100)) return false;
    	if ((b <= 20) || (b >= 100)) return false;
    	
    	return true;
    }
    Last edited by DPK; September 24th, 2009 at 06:18 PM.
    Common issues w/ Boxee:
    Beta Important Info | FAQ & Support Requests | Hulu Mature Content | Search

    UnBoxeed app development:
    Comics.com | ESPN360 | Weather

    For more info, follow app development on Twitter!

  5. #5

    Default

    This is awesome, thanks!

  6. #6
    Join Date
    Feb 2009
    Posts
    427

    Default

    Quote Originally Posted by DPK View Post
    just drop the below code in a file called weather.js and save it to the /boxee/system/players/flashplayer directory.
    would love to see boxee scan the active plugin's directory for a file like this rather then having to manually place files in the boxee directory.

    for example
    skin files are located at:
    plugin\skin\Boxee Skin NG\720p\window.xml

    would love to see just:
    plugin\players\flashplayer\site.js

    If I remember looking in the boxee browser log there are a few different places that it searches locally first for a js file before the helper2 url. would be nice if the first place it searches would be plugin specific.

  7. #7

    Default

    Quote Originally Posted by xmcnuggetx View Post
    If I remember looking in the boxee browser log there are a few different places that it searches locally first for a js file before the helper2 url. would be nice if the first place it searches would be plugin specific.
    Where is the browser log btw? I've been searching everywhere for the darn thing to no luck.
    Common issues w/ Boxee:
    Beta Important Info | FAQ & Support Requests | Hulu Mature Content | Search

    UnBoxeed app development:
    Comics.com | ESPN360 | Weather

    For more info, follow app development on Twitter!

  8. #8
    Join Date
    Sep 2009
    Posts
    8

    Default

    How does the Boxee knows which javascript it needs to load? Is it specified in any of the "descriptor" files?

    Thanks,
    John

  9. #9

    Default

    Quote Originally Posted by clhsu View Post
    How does the Boxee knows which javascript it needs to load? Is it specified in any of the "descriptor" files?

    Thanks,
    John
    http://wiki.boxee.tv/JavaScript_API#JavaScript_API

    In short if you send a feed link to Boxee that is:
    http://www.youtube.com/watch?v=ViUwgbnwBVE

    Boxee automatically strips the domain from the url and then compares it to any existing helper2 controller files. So in this case Boxee would be looking for youtube.js.

    If there is no controller boxee will attempt to load the first widget/media file that it comes across on the page you are feeding it. The controller files only serve the purpose of interfacing Boxee with the controls that exist in flash/silverlight/etc players. Basically just mapping things from Boxee button to browser button.
    Common issues w/ Boxee:
    Beta Important Info | FAQ & Support Requests | Hulu Mature Content | Search

    UnBoxeed app development:
    Comics.com | ESPN360 | Weather

    For more info, follow app development on Twitter!

  10. #10
    Join Date
    Feb 2009
    Posts
    427

    Default

    Quote Originally Posted by DPK View Post
    Where is the browser log btw? I've been searching everywhere for the darn thing to no luck.
    I'm on windows and not sure if this is still the case, but it was actually in the bxflashplayer directory within program files. Here is my post about what it looks like (at work and no boxee version here).
    http://forum.boxee.tv/showthread.php?t=9886&page=2

Similar Threads

  1. What happens next with the GUI API/Python API ?
    By Severus in forum boxee applications
    Replies: 5
    Last Post: January 4th, 2012, 04:15 AM
  2. Eliminating show reference/art
    By rocks911 in forum Boxee Box help
    Replies: 13
    Last Post: December 3rd, 2011, 02:23 PM
  3. Unable to remove a reference in 'Unidentified Files'
    By brandycmc in forum Boxee Box help
    Replies: 1
    Last Post: December 13th, 2010, 06:25 PM
  4. Offline video library with reference numbers for movies
    By fredphoesh in forum feature requests
    Replies: 3
    Last Post: April 5th, 2010, 08:49 AM
  5. flash/Helper2 API confussion
    By dkane in forum boxee applications
    Replies: 10
    Last Post: October 12th, 2009, 04:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •