diff --git a/package.json b/package.json index 7a00537..26d793f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-opentok", - "version": "1.6.7", + "version": "1.6.8", "description": "Integrates OpenTok for NativeScript.", "main": "opentok.js", "typings": "./opentok.d.ts", diff --git a/src/android/subscriber.ts b/src/android/subscriber.ts index 11ba24a..a906a59 100644 --- a/src/android/subscriber.ts +++ b/src/android/subscriber.ts @@ -10,6 +10,8 @@ export class TNSOTSubscriber extends ContentView { private _android: any; private _subscriber: any; private _events:Observable; + _render_style: any; + constructor(){ super(); this._events = new Observable(); @@ -33,8 +35,7 @@ export class TNSOTSubscriber extends ContentView { subscribe(session: any, stream: any) { const that = new WeakRef(this); this._subscriber = new com.opentok.android.Subscriber(utils.ad.getApplicationContext(), stream); - this._subscriber.getRenderer().setStyle(com.opentok.android.BaseVideoRenderer.STYLE_VIDEO_SCALE, - com.opentok.android.BaseVideoRenderer.STYLE_VIDEO_FILL); + this._subscriber.getRenderer().setStyle(com.opentok.android.BaseVideoRenderer.STYLE_VIDEO_SCALE, this.render_style); this._subscriber.setSubscriberListener(new com.opentok.android.SubscriberKit.SubscriberListener({ owner: that.get(), onConnected(subscriber){ @@ -135,4 +136,25 @@ export class TNSOTSubscriber extends ContentView { return this._events; } + get render_style() { + return this._render_style; + } + + set render_style(value: any) { + switch (value) { + case 'fit': + this._render_style = com.opentok.android.BaseVideoRenderer.STYLE_VIDEO_FIT; + break; + case 'fill': + this._render_style = com.opentok.android.BaseVideoRenderer.STYLE_VIDEO_FILL; + break; + case 'scale': + this._render_style = com.opentok.android.BaseVideoRenderer.STYLE_VIDEO_SCALE; + break; + default: + this._render_style = com.opentok.android.BaseVideoRenderer.STYLE_VIDEO_FILL; + break; + } + } + } \ No newline at end of file