View Full Version : jsactions - need some current examples
Fuzzgtp
July 15th, 2009, 08:55 AM
cant seem to get any of these to work :(
can someone give me a working example. (preferable something simple)
ameno
July 20th, 2009, 11:27 AM
Here's what we are using in BoXXXee right now:
boxee.browserWidth=640;
boxee.browserHeight=480;
boxee.enableLog(true);
if(boxee.getVersion() > 3.0)
{
boxee.setCanPause(true);
boxee.setCanSkip(true);
boxee.setCanSetVolume(true);
}
boxee.autoChoosePlayer=false;
boxee.renderBrowser=true;
function UpdateProgress()
{
var activeWidget = boxee.getActiveWidget();
if(activeWidget)
{
var activeWidgetAttId = activeWidget.getAttribute('name');
var currentTime = boxee.runInBrowser('document.'+activeWidgetAttId+' .currentTime();');
var duration = boxee.runInBrowser('document.'+activeWidgetAttId+' .duration();');
var progress = (parseFloat(currentTime) / parseFloat(duration)) * 100;
if((parseFloat(duration) > 0) && (!durationWasSet))
{
boxee.setDuration(parseFloat(duration));
durationWasSet = true;
}
boxee.notifyCurrentTime(Math.round(parseFloat(curr entTime)));
boxee.notifyCurrentProgress(Math.round(progress));
if (progress >= 100)
{
boxee.notifyPlaybackEnded();
}
else
{
setTimeout(UpdateProgress,3000);
}
}
else
{
boxee.notifyPlaybackEnded();
}
}
var foundActive=false;
var durationWasSet=false;
function setActiveWidget()
{
boxee.getWidgets().forEach(function(A)
{
if (A.width > 600 && A.height > 300 && A.getAttribute("src") != "")
{
A.setActive(true);
boxee.notifyConfigChange(A.width,A.height);
foundActive=true;
setTimeout(UpdateProgress,5000);
}
});
if(!foundActive)
{
setTimeout(setActiveWidget,1000);
}
}
setTimeout(setActiveWidget,1000);
boxee.onPlay = function()
{
boxee.runInBrowser('document.'+boxee.getActiveWidg et().getAttribute('name')+'.resume();');
}
boxee.onPause = function()
{
boxee.runInBrowser('document.'+boxee.getActiveWidg et().getAttribute('name')+'.pause();');
}
boxee.onSkip = function()
{
boxee.runInBrowser('document.'+boxee.getActiveWidg et().getAttribute('name')+'.seek(60);');
}
boxee.onBigSkip = function()
{
boxee.runInBrowser('document.'+boxee.getActiveWidg et().getAttribute('name')+'.seek(300);');
}
boxee.onBack = function()
{
boxee.runInBrowser('document.'+boxee.getActiveWidg et().getAttribute('name')+'.seek(-60);');
}
boxee.onBigBack = function()
{
boxee.runInBrowser('document.'+boxee.getActiveWidg et().getAttribute('name')+'.seek(-300);');
}
boxee.onSetVolume = function(volume)
{
boxee.runInBrowser('document.'+boxee.getActiveWidg et().getAttribute('name')+'.changeVolume('+volume+ ');');
}
furkansakar
February 12th, 2010, 07:48 AM
Can I use same code for different web-sites. I mean, web-sites are using different players based on flash object. For instance, flowplayer may have different attributes.
I searched for some of .js code of applications, there are different approaches, one of them is using exact button position and add click function, some of them are using getAttribute like above example. Some of them are directly calling player etc. Which one is global for all flash embeds.
Best Regards
-furkan
ZombieBraintrust
February 12th, 2010, 08:03 AM
Here is the helper I have for Funimation.com
http://dir.boxee.tv/apps/helper2/funimation.js
one of them is using exact button position and add click function
Mine is of the exact button position variety. I coded it this way because I'm not that familiar with Flash or JavaScript. I don't think there is a global method for flash embeds. If there was then Boxee would be able to play flash embeds without jsactions files.
I think this is a great subject to post tutorials about.
fischer70
March 14th, 2010, 08:31 PM
I'm a bit confused here on where to put js stuff in an application. None of the examples seem to mention them, but the problem I'm having appears to result from the underlying boxee browser grabbing the wrong panel. The API's look like I can control this behavior through the js api, but could use a pointer. Where do I drop .js files in my application directory for them to get picked up? Better yet, where can I grab an entire example that includes some use of the js api?
Thanks!
DPK
March 14th, 2010, 10:51 PM
Where do I drop .js files in my application directory for them to get picked up? Better yet, where can I grab an entire example that includes some use of the js api?
http://developer.boxee.tv/JavaScript_API
Some examples here:
Apple (http://dir.boxee.tv/apps/helper2/apple.js)
BBC (http://dir.boxee.tv/apps/helper2/bbc.js)
CBS (http://dir.boxee.tv/apps/helper2/cbs.js)
Comedy Central (http://dir.boxee.tv/apps/helper2/comedycentral.js)
CNN (http://dir.boxee.tv/apps/helper2/cnn.js)
Current TV (http://dir.boxee.tv/apps/helper2/current.js)
Fancast (http://dir.boxee.tv/apps/helper2/fancast.js)
FOX (http://dir.boxee.tv/apps/helper2/fox.js)
FORA.tv (http://dir.boxee.tv/apps/helper2/fora.js)
Google (http://dir.boxee.tv/apps/helper2/google.js)
Hulu (http://dir.boxee.tv/apps/helper2/hulu.js)
Joost (http://dir.boxee.tv/apps/helper2/joost.js)
Metacafe (http://dir.boxee.tv/apps/helper2/metacafe.js)
MLB (http://dir.boxee.tv/apps/helper2/mlb.js)
MTV (http://dir.boxee.tv/apps/helper2/mtv.js)
MTV Music (http://dir.boxee.tv/apps/helper2/mtvmusic.js)
MySpace (http://dir.boxee.tv/apps/helper2/myspace.js)
NBA (http://dir.boxee.tv/apps/helper2/nba.js)
NBC (http://dir.boxee.tv/apps/helper2/nbc.js)
Netflix (http://dir.boxee.tv/apps/helper2/netflix.js)
PBS (http://dir.boxee.tv/apps/helper2/pbs.js)
Revision3 (http://dir.boxee.tv/apps/helper2/revision3.js)
South Park Studios (http://dir.boxee.tv/apps/helper2/southparkstudios.js)
TED (http://dir.boxee.tv/apps/helper2/ted.js)
The Onion (http://dir.boxee.tv/apps/helper2/theonion.js)
The WB (http://dir.boxee.tv/apps/helper2/thewb.js)
Vimeo (http://dir.boxee.tv/apps/helper2/vimeo.js)
Youtube (http://dir.boxee.tv/apps/helper2/youtube.js)
agentlame
March 14th, 2010, 11:18 PM
http://developer.boxee.tv/JavaScript_API
Some examples here:
Apple (http://dir.boxee.tv/apps/helper2/apple.js)
BBC (http://dir.boxee.tv/apps/helper2/bbc.js)
CBS (http://dir.boxee.tv/apps/helper2/cbs.js)
Comedy Central (http://dir.boxee.tv/apps/helper2/comedycentral.js)
CNN (http://dir.boxee.tv/apps/helper2/cnn.js)
Current TV (http://dir.boxee.tv/apps/helper2/current.js)
Fancast (http://dir.boxee.tv/apps/helper2/fancast.js)
FOX (http://dir.boxee.tv/apps/helper2/fox.js)
FORA.tv (http://dir.boxee.tv/apps/helper2/fora.js)
Google (http://dir.boxee.tv/apps/helper2/google.js)
Hulu (http://dir.boxee.tv/apps/helper2/hulu.js)
Joost (http://dir.boxee.tv/apps/helper2/joost.js)
Metacafe (http://dir.boxee.tv/apps/helper2/metacafe.js)
MLB (http://dir.boxee.tv/apps/helper2/mlb.js)
MTV (http://dir.boxee.tv/apps/helper2/mtv.js)
MTV Music (http://dir.boxee.tv/apps/helper2/mtvmusic.js)
MySpace (http://dir.boxee.tv/apps/helper2/myspace.js)
NBA (http://dir.boxee.tv/apps/helper2/nba.js)
NBC (http://dir.boxee.tv/apps/helper2/nbc.js)
Netflix (http://dir.boxee.tv/apps/helper2/netflix.js)
PBS (http://dir.boxee.tv/apps/helper2/pbs.js)
Revision3 (http://dir.boxee.tv/apps/helper2/revision3.js)
South Park Studios (http://dir.boxee.tv/apps/helper2/southparkstudios.js)
TED (http://dir.boxee.tv/apps/helper2/ted.js)
The Onion (http://dir.boxee.tv/apps/helper2/theonion.js)
The WB (http://dir.boxee.tv/apps/helper2/thewb.js)
Vimeo (http://dir.boxee.tv/apps/helper2/vimeo.js)
Youtube (http://dir.boxee.tv/apps/helper2/youtube.js)
Hulu is obfuscated, for some odd reason.
DPK
March 14th, 2010, 11:39 PM
Hulu is obfuscated, for some odd reason.
Probably so Hulu has no idea what Boxee's doing so they can't circumvent anything.
fischer70
March 15th, 2010, 08:23 AM
Thanks! Wow, totally missed that the Control-scripts section completely gave me the info I was looking for! Thanks for the many links!
And you didn't even say RTFM!
DPK
March 15th, 2010, 08:32 AM
And you didn't even say RTFM!
We're here to serve. :)
agentlame
March 16th, 2010, 04:48 PM
Probably so Hulu has no idea what Boxee's doing so they can't circumvent anything.
I'm a moron.... duh.
Wackabi
February 27th, 2011, 12:46 PM
I think this is a great subject to post tutorials about.
Oh Yes, it would safe me a lot of real life time :) If I ever figure that out, I will be happy person :)
Powered by vBulletin® Version 4.1.12 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.