Trying to implement an external Java interface in Nativescript Android Plugin

Viewed 134

I am trying to use an interface from this library in a NativeScript Android Angular application.

The library is : https://github.com/begeekmyfriend/yasea

The code is as follows:

@Interfaces([net.ossrs.yasea.SrsRecordHandler.SrsRecordListener])
export class MyComponent extends Common implements net.ossrs.yasea.SrsRecordHandler.SrsRecordListener 
{

The above gives me the error "cannot find namespace net"

I have included external libraries before so I know where to put the aar in the folder structure. I can call other functions like so:

declare var com: any;
declare var android: any;
declare var java: any;
declare var net: any;

let SrsCameraView = net.ossrs.yasea.SrsCameraView;
let SrsPublisher = net.ossrs.yasea.SrsPublisher;

 @Interfaces([net.ossrs.yasea.SrsRecordHandler.SrsRecordListener])
 export class MyComponent extends Common implements net.ossrs.yasea.SrsRecordHandler.SrsRecordListener 
 {
 
 public createNativeView(): Object {


 // the following works without errors
this._mCameraView = new SrsCameraView(androidApp.context);
this._mPublisher = new SrsPublisher(this._mCameraView);

...
return this._mCameraView;
}

Is there something I am missing because I am trying to set up an interface with a net.X.X instead of com.X.X?

The interface is definitely in that namespace.

The error is a compile time error. This is the error that is returned:

mycomponent.android.ts:60:46 - error TS2503: Cannot find namespace 'net'.

60 export class MyComponent extends Common implements net.ossrs.yasea.SrsRecordHandler.SrsRecordListener {
                                                ~~~

mycomponent.android.ts:60:46 - error TS4019: Implements clause of exported class 'Wowza' has or is using private name 'net'.

60 export class MyComponent extends Common implements net.ossrs.yasea.SrsRecordHandler.SrsRecordListener {

Thanks!!

0 Answers
Related