firefox os_如何在電視上測試Firefox OS應用

firefox os

One of my responsibilities in my new role in Partner Engineering at Mozilla is testing HTML5-powered apps and games on Panasonic televisions.  The television in my office, a beautiful 60" 4K Ultra HD beast, is the perfect device for the job.  But how do I get the app from my local computer to the television for testing?  This blog post will walk you through the process of testing your HTML5 app on Firefox OS-powered televisions.

在Mozilla合作伙伴工程部門擔任新職務時,我的職責之一是在松下電視上測試基於HTML5的應用和遊戲。 我辦公室的電視是一臺漂亮的60英寸4K Ultra HD野獸,是完成這項工作的理想設備。但是,如何將應用程序從本地計算機下載到電視上進行測試?這篇博客文章將引導您完成以下過程:在基於Firefox OS的電視上測試HTML5應用。

It's important to note before we get started that using the browser app to view a URL isn't the same, as the app isn't in "highlight mode" and the browser chrome takes up real estate.

在開始之前,請務必注意,使用瀏覽器應用程序查看URL並不相同,因爲該應用程序未處於「突出顯示模式」,並且瀏覽器chrome佔用了資源。

步驟1:使用Firefox Web Developer WebIDE連接到電視 (Step 1:  Use the Firefox Web Developer WebIDE to Connect to Television)

Firefox's awesome Developer Tools provides a WebIDE which features a "Remote Runtime" functionality.  This remote runtime allows you to connect your desktop computer to your Firefox OS television via IP.  I wont repeat the documentation on how to do connect to the TV, I'll instead point you to this article on MDN:  How to connect WebIDE to TV.  The article on MDN walks you through, with screenshots, how to connect to the TV.

Firefox強大的開發人員工具提供了一個WebIDE,該WebIDE具有「遠程運行時」功能。 此遠程運行時允許您通過IP將臺式計算機連接到Firefox OS電視。 我不會重複有關如何連接到電視的文檔,而是將您指向MDN上的這篇文章: 如何將WebIDE連接到電視 。 MDN上的文章通過屏幕截圖引導您如何連接電視。

步驟2:將應用程序作爲打包的應用程序側載 (Step 2:  Sideload the App as a Packaged App)

Firefox OS TVs only allow for "hosted" apps (you provide a URL where the app lives) and not "packaged" apps (a .zip file with all of the app's assets), however to test your app on the TV, you'll need to load the app a packaged app within the WebIDE.  Weird, right?  The packaged app will be incredibly simple and I'll even provide you the template:

Firefox OS電視僅允許「託管」應用程序(您提供應用程序所在的URL),而不允許「打包」應用程序(包含所有應用程序資產的.zip文件),但是要在電視上測試您的應用程序,需要在WebIDE中將應用程序加載爲打包的應用程序。 奇怪吧? 打包的應用程序將非常簡單,我什至爲您提供模板:

You only need to make a few changes:

您只需要進行一些更改:

  • Open app.js and change the window.location address to the address of your hosted app

    打開app.js並將window.location地址更改爲託管應用程序的地址

  • Open webapp.manifest and provide an app name as you'd like it to appear on the TV

    打開webapp.manifest並提供您想要在電視上顯示的應用名稱

That's all you need to do, though you may also want to also provide a real app icon image.

這就是您需要做的,儘管您可能還想提供一個真實的應用程序圖標圖像。

With the packaged app in place, and assuming you've connected the WebIDE Remote Runtime to the TV, click "Open Packaged App..." and select your app directory.  You'll see the information loaded like this:

打包應用程序到位後,並假設您已將WebIDE遠程運行時連接到電視,請單擊「打開打包的應用程序...」,然後選擇您的應用程序目錄。 您會看到這樣加載的信息:

Firefox WebIDE

Once the app information has loaded in WebIDE, you can click the "play" icon to "push" the app to your TV.  The app will instantly launch on the television when you press the play icon.  If you go to the Firefox OS home screen for the TV, you will see the app name and icon; you can open the app on the TV from that point forward.  If you make changes to the app, simple press the "play" icon again and the app will be re-installed on your TV!

將應用程序信息加載到WebIDE中後,您可以單擊「播放」圖標以將應用程序「推送」到電視上。 按下播放圖標時,該應用程序將立即在電視上啓動。 如果轉到電視的Firefox OS主屏幕,則會看到應用程序名稱和圖標。 您可以從那時開始在電視上打開該應用。 如果您對應用程序進行了更改,只需再次按「播放」圖標,該應用程序就會重新安裝在電視上!

Firefox OS TV

翻譯自: https://davidwalsh.name/firefox-tv

firefox os