Joost插件开发

 

Joost Widgets是一些第三方开发的独立软件包,供Joost加载以扩展其功能,类似于Skype插件。

 

Joost Widget 开发介绍页面

http://dev.joost.com/widgets/index.html

 

.  Joost插件加载方法

打开Joost主程序,以中文版为例,选择右边按钮我的Joost”,点击百宝箱菜单,再点击百宝箱管理,进入的插件管理界面,点击添加工具,弹出文件选择框,选择本地的Joost插件文件(以.joda为后缀的zip压缩文件,新版Joost直接支持.zip后缀文件)。

以后在百宝箱菜单中将出现你加载的插件,点击即可使用。

 

. Joost插件开发

Joost插件文件(*.joda)是由一些XML文件,JavaScript文件等源码文件使用ZIP格式压缩的包,以下为涂鸦插件Krabbel为例(在官网的示例插件中可以下载到)。

1。配置文件config.xml,其中的<main-file>节指定插件的源码文件名krabbel.xml

 

  <widget-manifest xmlns='http://joost.com/ns/widget-manifest#'>
  <id>http://www.croczilla.com/krabbel/</id>
  <website>http://www.croczilla.com/krabbel/</website>
  <name>Krabbel Doodler</name>
  <main-file>krabbel.xml</main-file>
  <icon>icon.png</icon>
  <width>410</width>
  <height>500</height>
  <description>Doodle on the screen and compare with others' doodles.</description>
</widget-manifest>

 

2。主源码文件,比如为krabbel.xml

这里是XHTML源码,其中嵌入的JavaScript代码可以使用Joost Widget API提供的原生对象,具体见下面的介绍。

比如使用XMLHttpRequest对象的代码如下:

 

      var req = new XMLHttpRequest();
      req.open("GET", host + "/topic", true);
      req.onreadystatechange = function () {
        req.overrideMimeType("text/plain");
        if (req.readyState == 4) {
          var resp = req.responseText;
          var pos = resp.indexOf(" ");

 

          current_topic = resp.substring(0, pos);
          topic.textContent = resp.substring(pos);
        }
      }
      req.send(null);

 

 

. Joost插件API

 

     Joost提供了5JavaScript原生类供插件开发者使用。这5JavaScript原生类有的可以供第三方获取Joost的配置信息,用户正在观看的频道信息,Joost用户信息(比如用户名等)。

http://dev.joost.com/widgets/api/index.html

XMLHttpRequest

By and large, this is the same API that you know well from within browsers; some restrictions have been added, while others have been loosened.

Runtime Engine Information

The Runtime Engine provides all manners of information about what the viewer is currently watching, as well as access to functionality such as seeking or switching channels. It is the API to the TV.

Global

The small set of miscellaneous methods added directly to the global Javascript context.

Joost

An object that exposes information specific to the user's current Joost installation (e.g. their name).

Preferences

The API for the storage and retrieval of permanent client-side settings.  

 

你可能感兴趣的:(JavaScript,api,function,XHTML,XMLhttpREquest,methods)