Samsung / tizen-tv-webapis

Apache License 2.0
28 stars 11 forks source link

TS: Using tizen-tv-webapis in Angular 10 #21

Closed ionescu77 closed 2 years ago

ionescu77 commented 3 years ago

Hello,

I am trying to use the Tizen TV Webapis inside an angular project.

I am able to run the angular app on the Samsung TV.

However when I include the resources (including types) in my project, it won't work:

Screenshot 2021-04-05 at 18 20 47

I get this

Uncaught TypeError: Cannot destructure property 'adinfo' of 'window.webapis' as it is undefined.
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>MmTizenAngular</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <script
      type="text/javascript"
      src="$WEBAPIS/webapis/webapis.js"
  ></script>
</head>
<body>
  <app-root></app-root>
</body>
</html>
import { Component, ElementRef, OnInit, AfterViewInit, ViewChild } from '@angular/core';
import { avinfo } from 'tizen-tv-webapis';

import { CronJob } from 'cron';

const { getVersion, getDolbyDigitalCompMode, isHdrTvSupport } = avinfo;

// ...
prozanne commented 3 years ago

Hi :) Could you please check one more time you've already installed modules. (But I guess you already did it.) And also please check the version of them. (It should be over v2.0.0)

npm install tizen-tv-webapis npm install @types/tizen-tv-webapis

If you still have same issue, and if you don't mind, could you please share the codes? You can upload codes, and then delete after resolving issue, or you can share me as a mail.