PPAPI/NaCl browser plugin package customization

PPAPI/NaCl browser plugin package customization

Delivery package inventory

The delivery package is already uploadable as a module; it is however not customized for an operator. The package contains the following inventory:

  • docs.zip
  • integration_extension.zip
  • production_extension.zip

docs.zip

This tarball contains a browsable version of the JS APIs in HTML format. It is obviously not meant to be deployed on the Chrome store.

*_extension.zip

These tarballs are Chrome plugin extensions. While not being meant to be deployed as is, these are technically deployable already in the Chrome web store. NAGRA offers two extensions with different purposes, the differences are summrized in the table below.

Tarball name

Purpose

NAGRA logo overlay

PRM logging

Hardening

Whitebox cryptography

integration_extension.zip

Integration

Yes

Yes

Yes

Yes

production_extension.zip

Production

No

No

Yes

Yes

Each of these tarballs is structured as follows:

│   background.js
│   content_script.js
│   icon_128x128.png
│   manifest.json
│   Player.nmf
│   Player_x86_32.nexe
│   Player_x86_64.nexe
│
└───resources
        NMPBPAPI.js
        opvault.json

Customize the extension

The extension zip files delivered are uploadable as is. They contain a valid manifest file, NaCl binaries, resource files and some icons, but as mentioned earlier, some of these items must be customized to fit the operator needs. The entry point of any Chrome application or plugin is the manifest file, namely manifest.json. The format of the file can be found in the reference below.

Reference

https://developer.chrome.com/extensions/manifest

The extension zip files that are part of the NAGRA delivery package already contain a valid manifest.json file, which looks like this:

{
  "name": "Nagra Media Player Extension",
  "version": "0.1.0",
  "minimum_chrome_version": "39.0.2171.71",
  "icons": { "128": "icon_128x128.png" },
  "manifest_version": 2,
  "description": "Nagra Secure Player for Chrome",
  "background": { "scripts": ["background.js"],
                  "persistent": false },
  "content_scripts": [{ "matches": ["http://otvplayer.nagra.com/*", "https://otvplayer.nagra.com/*"],
                        "js": ["content_script.js"] }],
  "nacl_modules": [{ "path": "Player.nmf",
                     "mime_type": "application/vnd.nagra.secureplayer.pepper.plugin" }],
  "requirements": { "3D": { "features": ["webgl"] } },
  "web_accessible_resources": [ "*" ],
  "permissions": ["power", "system.cpu", "system.display"]
}

Manifest permissions

The permissions section of the manifest.json file is where the operator requests the ability to use certain features of the browser, as per https://developer.chrome.com/extensions/declare_permissions. A summary of each of the minimum permissions that are required by NAGRA:

permission requirement Nagra justification
power This is necessary for requesting/releasing the screensaver keep awake we use during video playback.

system.cpu

system.display

This is necessary for queries of device information.

 

Identification

Some of the manifest.json file fields must be changed to cater for the operator needs and environment.

Requirement

The following fields MUST be changed according to the operator environment :

name

version

description

default_locale

nacl_modules.mime_type

These fields are visible by the end user:

  • in the chrome web store
  • during installation
  • in the chrome extension management page (chrome://extensions)

For example:

  "name": "<extension_name>",
  "version": "<extension_version>",
  "default_locale": "<extension_default_locale>",
  "description": "<extension_description>",
  "nacl_modules": [{ ...,
                     "mime_type": "application/<extension_mime_type>" }],

Reference

https://developer.chrome.com/extensions/manifest/name

https://developer.chrome.com/extensions/manifest/version

https://developer.chrome.com/extensions/manifest/nacl_modules

Icons

Requirement

The default icon file MUST be replaced with a proper operator specific icon.

These icons are visible by the end user:

  • in the chrome web store
  • during installation
  • in the chrome extension management page (chrome://extensions)

The 16x16 icon is used as favicon. As the OpenTV Player BP PPAPI isn't creating any visible UI, this resolution isn't really necessary. The operator is free to add additional icons, for example:

  "icons": { "48": "icon48.png",
            "128": "icon128.png" },

Reference

https://developer.chrome.com/extensions/manifest/icons

https://developer.chrome.com/webstore/images#iconsize

Extension scripts

OpenTV Player uses some extension scripts to implement gain access to some resources not available today within the NaCl environment. The following entries can be extended with other scripts, but shall not be removed.

  "background": { "scripts": ["background.js"],
                  "persistent": false },
  "content_scripts": [{ "matches": ["http://otvplayer.nagra.com/*", "https://otvplayer.nagra.com/*"],
                        "js": ["content_script.js"] }],

Its is recommended that the matches field within content_scripts provides a distinct pattern of domains in order to meet criteria when your extension is published and undergoes the Google Chrome web store policies review.  The content_script.js file is necessary for queries of device information.

Localization

If the portal application is internationalized, the developer integrating the extension should pay attention to the fact that some additional effort is necessary to display the extension on the Chrome Web Store properly. The manifest.json file will most need to be internationalized as well, as described in the reference below.

Reference

https://developer.chrome.com/webstore/i18n

Technical data

Requirement

The following fields MUST not be changed:

manifest_version

minimum_chrome_version

nacl_modules.path

requirements

web_accessible_resources

For example:

  "manifest_version": 2,
  "minimum_chrome_version": "39.0.2171.71",
  "nacl_modules": [{ "path": "Player.nmf",
                     ... }],
  "requirements": { "3D": { "features": ["webgl"] } },
  "web_accessible_resources": [ "*" ],
  "permissions": [ "system.cpu", 
                   "system.display",
                   "power"]

Chrome web store

The way to deploy NaCl plugins is through the Chrome web store, using a similar approach to the iOS app store or Android google play.

Inline installation

It is recommended to use inline installation to make the plugin deployment as seamless as possible for the end user. That requires the portal JavaScript application to embed a link to the published plugin, as follows:

<link rel="chrome-webstore-item" 
      href="https://chrome.google.com/webstore/detail/<itemID>">

With <itemID> being the app ID attributed by the store when creating the extension. The portal application can then determine whether the plugin is installed in the Chrome environment, and prompt the end user for installation if he wishes to benefit from the OTT service. On user agreement, the portal application can simply invoke chrome.webstore.install() on the web store link described above to trigger the plugin installation. If the Chrome extension is already installed, the portal application can simply ignore the above and instantiate the plugin. It is important to understand that inline installation will imply some verification that can impart some delay on the publishing.

For more information on inline installation, please consult the following reference:

Reference

https://developer.chrome.com/webstore/inline_installation

Visibility options

The Chrome Web Store offers different visibility options that are important from a development team. When publishing, the developer can choose between the following:

Visibility

Effect

Public

Everyone can see it.

Unlisted

Only people with the link can see it.

Private

Only trusted testers from the developer dashboard can see it. You can also include members of a Google Group that you own or manage.

Updates

The plugin will not require any maintenance from the end user, as subsequent visits to web portal will not require extension installation, and the extension will update automatically when a new version is published. To push a new version, the developer can push them via the Chrome web store developer dashboard.

Extensions uploaded to the dashboard undergo a policy review where criteria for listings need to be met before publication is permitted.  There are some attributes that will require text justification and this is enforced before submitting to a review process.  Ensure the notes above are considered when submitting for publication and use the Why can't I publish? button to highlight which points need addressing.