voxeet / voxeet-uxkit-cordova

Dolby.io UXKit for Cordova
Other
1 stars 14 forks source link

Initializing in Ionic 4/3 / Angular 7/6/5 - How to import the VoxeetSDK? #4

Closed bijanmmarkes closed 5 years ago

bijanmmarkes commented 5 years ago

Describe the bug I am unable to initialize the VoxeetSDK variable when using an Ionic 4 / Angular 7 project. I add the plugin using cordova, but there is no way to import it as VoxeetSDK or Voxeet doesn't seem to exist.

Has anyone initialized this library using ionic 4, is it possible?

Expected Behaviour To be able to import Voxeet using the following Ionic format: import {Voxeet, UserInfo} from 'cordova-plugin-voxeet'

using the Const {Voxeet, UserInfo} = VoxeetSDK is invalid in ionic projects, even if ran after device ready. Also it throws an error when trying to compile since it doesn't actually exist.

Ex error message:

ERROR in src/app/services/stream/stream.service.ts(6,30): error TS2304: Cannot find name 'VoxeetSDK'.
src/app/services/stream/stream.service.ts(93,46): error TS2304: Cannot find name 'UserInfo'.

[ERROR] An error occurred while running subprocess ng.

The above causes the compilation to fail.

Steps to Reproduce the Problem

  1. Follow steps on README in Ionic 4 project
  2. Try to import from VoxeetSDK
  3. Watch it throw errors / fail building / be non-existent.

Unless I'm missing something, I followed the README exactly but it seems to only be built for raw cordova? Most people are using frameworks like Ionic now-a-days. If ionic 4 is not supported, will it be? If it is supported, is there a different repo, am I doing something wrong?

Minimalistic code (recommended)

Tried many different approaches such as:

import Voxeet from 'cordova-plugin-voxeet/www/Voxeet'; import Voxeet from 'cordova-plugin-voxeet'; import {Voxeet, UserInfo} from 'cordova-plugin-voxeet';

Specifications

Multiple devices and simulators -- Basically won't even compile. Not reachable via developer tools either.

Any advice would help.

Thanks!

codlab commented 5 years ago

The typical way to use cordova plugin is to directly use the window injection.

To do so, simply you can use (<any>window).VoxeetSDK for instance. There are various manipulation possible such as the overall declaration using the implicit window import for instance

It's currently unplanned to have support for Ionic framework - maybe in the future, we'll let you know