开始

Estimated reading time: 3 minutes

本“HTML5应用程序”部分描述了如何在BRAVIA商用显示器上开发、安装和运行HTML5应用程序。

首先,本部分描述从USB存储启动简单应用程序的应用程序打包的基本信息。 支持的格式是FAT32、NTFS和exFAT。

应用程序打包

文件和目录结构

HTML5应用程序必须对文件和目录结构使用以下规则。

USB: /sony/
          +--- autorun.txt
          +--- apps/webapps/
                           +--- <application_name_1>/app/ // Application Directory
                                                        +--- manifest.json
                                                        +--- <resource>/
                                                                       +--- <static_files>
                           +--- <application_name_2>/app/ // Application Directory
                                                        +--- manifest.json
                                                        +--- <resource>/
                                                                       +--- <static_files>
                           :
     /media/
           + video1.mp4
           + video2.mp4
           :

可以接受任何目录名作为应用程序名,并且可以在其中存储一个或多个应用程序 /sony/apps/webapps/ 目录. 此外,您可以存储静态文件,如 *.html, *.js, *.css or *.png under /sony/apps/webapps/<application_name>/app/<resource>/, 你可以通过 file://localhost/<resource>/<static_files>. 当您将所有应用程序文件存储在USB存储器中时,应用程序可以在没有网络连接的情况下工作。 它作为离线应用程序工作。

autorun.txt

autorun.txt contains an auid to specify an application to launch. The application must be stored in /sony/apps/webapps/ directory. The following is a minimum example of autorun.txt.

{
  "auid": "net.sony.tv.sample.manifestjson_weburl"
}

autorun.txt can also define an application action (launch/copy/remove) when BRAVIA Professional Display detects an application directory.

Please visit autorun.txt for the details of autorun.txt.

manifest.json

The manifest file manifest.json contains application information like auid (Application Unique ID), title, splash image, initial URL, etc. The Manifest filename must be "manifest.json". The following is an example of manifest.json.

{
  "name": {
    "default": "en_US",
    "en_US": "[Sample] Launch from web_url"
  },
  "auid": "net.sony.tv.sample.manifestjson_weburl",
  "version": "1.0",
  "manifest_version": "1.0",
  "app": {
    "launch": {
      "web_url": "https://example.com/myapp"
    }
  },
  "splash": "splash.jpg",
  "minimum_web_platform_version": "1.0"
}

Please visit manifest.json for the details of manifest.json.

从USB存储器运行程序

Case 1. Show a Web Site

Please download and extract a sample application. After extracting, put files as follows. Please download and extract it. And put files as below.

USB: /sony/
          +--- autorun.txt
          +--- apps/webapps/manifestjson_weburl/app/manifest.json

To launch, set an application from a USB the the following steps.

  1. In manifest.json, set the "web_url" property. The following example will show "https://example.com/" when launching an application.
    {
     "name": {
       "default": "en_US",
       "en_US": "[Sample] Launch from web_url"
     },
     "auid": "net.sony.tv.sample.manifestjson_weburl",
     "version": "1.0",
     "manifest_version": "1.0",
     "app": {
       "launch": {
         "web_url": "https://example.com/"
       }
     },
     "minimum_web_platform_version": "1.0"
    }
    
  2. Te Copy 'sony' directory to the root directory of the USB storage.
  3. Connect the USB storage to BRAVIA Professional Display. The application will be launched and show a web site of "web_url" automatically.

Case 2. Launch a Local Application

Please download and extract a sample application. After extracting, put files as follows. And put files as below.
This sample does not include video.mp4 to be played, so you need to put a video content video.mp4 in /sony/apps/webapps/manifestjson_localpath/app/doc/ yourself.

USB: /sony/
          +--- autorun.txt
          +--- apps/webapps/manifestjson_localpath/app/
                                                      +--- manifest.json
                                                      +--- doc/
                                                              +--- index.html // Initial Page
                                                              +--- video.mp4 // Please put your sample file

To launch an application from a USB storage, do the following steps.

  1. In manifest.json, set the "local_path" property. The following example will show “doc/index.html” when launching an application.
    {
     "name": {
       "default": "en_US",
       "en_US": "[Sample] Launch from local_path"
     },
     "auid": "net.sony.tv.sample.manifestjson_localpath",
     "version": "1.0",
     "manifest_version": "1.0",
     "app": {
       "launch": {
         "local_path": "file://localhost/doc/index.html"
       }
     }
    }
    
  2. 将“索尼”目录复制到USB存储的根目录。

  3. 复制你的视频。 video.mp4 to /sony/apps/webapps/manifestjson_localpath/app/doc/。 请访问AV媒体格式了解支持的音频/视频媒体格式的详细信息。

  4. 连接USB存储器到BRAVIA商用显示器。 应用程序将被启动,并显示一个应用程序的顶部页面 local_path

您可以通过使用开发的文件替换 local_path 属性来启动HTML5应用程序。

Last modified: 10 Apr 2019