LG WebOS 无法在模拟器上运行需要 http 服务器的 Web 应用程序

问题描述 投票:0回答:2

我有一个在 WebOS 上运行 Flutter 应用程序的想法。我已经下载了最新的 WebOS sdk 和模拟器(因为他们已经弃用了模拟器) 我创建了一个简单的 Hello World 应用程序,它仅使用 HTML,并且它在模拟器上运行得很好。然后我决定向其中添加运行 Flutter 应用程序的逻辑。所以现在编译出来的app结构是这样的

index.html内容如下

<!DOCTYPE html>
<html>

<head>
  <base href="/">

  <meta charset="UTF-8">
  <meta content="IE=Edge" http-equiv="X-UA-Compatible">
  <meta name="description" content="A new Flutter project.">

  <!-- iOS meta tags & icons -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="flutter_iz_tube_tv">
  <link rel="apple-touch-icon" href="icons/Icon-192.png">

  <!-- Favicon -->
  <link rel="icon" type="image/png" href="favicon.png" />

  <title>IZ Tube TV</title>
  <link rel="manifest" href="manifest.json">

  <script>
    // The value below is injected by flutter build, do not touch.
    var serviceWorkerVersion = '3924677883';
  </script>
  <script src="flutter.js" defer></script>
  <script src="webOSTVjs-1.2.4/webOSTV.js" charset="utf-8"></script>
  <script src="webOSTVjs-1.2.4/webOSTV-dev.js" charset="utf-8"></script>
</head>

<body>
  <script>
    window.addEventListener('load', function (ev) {
      // Download main.dart.js
      _flutter.loader.loadEntrypoint({
        serviceWorker: {
          serviceWorkerVersion: serviceWorkerVersion,
        }
      }).then(function (engineInitializer) {
        return engineInitializer.initializeEngine();
      }).then(function (appRunner) {
        return appRunner.runApp();
      });
    });
  </script>
</body>

</html>

这是appinfo.json的内容

{
  "id": "com.example",
  "version": "0.0.1",
  "vendor": "Test TV",
  "type": "web",
  "main": "index.html",
  "title": "tv_app",
  "icon": "icon.png",
  "largeIcon": "largeIcon.png"
}

如果我使用网络服务器,这个应用程序可以在浏览器中正常运行。 但是当我使用 RCU 上的应用程序按钮将其加载到 WebOS 模拟器上时,问题就开始了。

我就是跑不了。显然,问题在于它使用简单的 file: 协议而不是运行 http 服务器。 我用谷歌搜索了很多,但没有找到解决方案。 有谁知道如何在模拟器中运行这样的应用程序?

simulator httpserver webos
2个回答
0
投票

我发现在模拟器中这是不可能做到的。但有一个解决方法。我们可以像这样向 index.html 文件的“head”部分添加重定向(https://webostv.developer.lge.com/develop/app-developer-guide/hosted-web-app/):

<meta http-equiv="refresh" content="0;url=http://0.0.0.0:8080/index.html">

从而有效地将其重定向到远程应用程序。 WebOS 可以显示 Flutter 应用程序


0
投票

在html中执行标签元,在字体LG中返回错误,说没有找到

© www.soinside.com 2019 - 2024. All rights reserved.