Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.

Commit 58f0d8b

Browse files
[UPDATE] Set Render Style in subscriber and Version bump.
1 parent a7f38be commit 58f0d8b

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-opentok",
3-
"version": "1.6.7",
3+
"version": "1.6.8",
44
"description": "Integrates OpenTok for NativeScript.",
55
"main": "opentok.js",
66
"typings": "./opentok.d.ts",

src/android/subscriber.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export class TNSOTSubscriber extends ContentView {
1010
private _android: any;
1111
private _subscriber: any;
1212
private _events:Observable;
13+
_render_style: any;
14+
1315
constructor(){
1416
super();
1517
this._events = new Observable();
@@ -33,8 +35,7 @@ export class TNSOTSubscriber extends ContentView {
3335
subscribe(session: any, stream: any) {
3436
const that = new WeakRef(this);
3537
this._subscriber = new com.opentok.android.Subscriber(utils.ad.getApplicationContext(), stream);
36-
this._subscriber.getRenderer().setStyle(com.opentok.android.BaseVideoRenderer.STYLE_VIDEO_SCALE,
37-
com.opentok.android.BaseVideoRenderer.STYLE_VIDEO_FILL);
38+
this._subscriber.getRenderer().setStyle(com.opentok.android.BaseVideoRenderer.STYLE_VIDEO_SCALE, this.render_style);
3839
this._subscriber.setSubscriberListener(new com.opentok.android.SubscriberKit.SubscriberListener({
3940
owner: that.get(),
4041
onConnected(subscriber){
@@ -135,4 +136,25 @@ export class TNSOTSubscriber extends ContentView {
135136
return this._events;
136137
}
137138

139+
get render_style() {
140+
return this._render_style;
141+
}
142+
143+
set render_style(value: any) {
144+
switch (value) {
145+
case 'fit':
146+
this._render_style = com.opentok.android.BaseVideoRenderer.STYLE_VIDEO_FIT;
147+
break;
148+
case 'fill':
149+
this._render_style = com.opentok.android.BaseVideoRenderer.STYLE_VIDEO_FILL;
150+
break;
151+
case 'scale':
152+
this._render_style = com.opentok.android.BaseVideoRenderer.STYLE_VIDEO_SCALE;
153+
break;
154+
default:
155+
this._render_style = com.opentok.android.BaseVideoRenderer.STYLE_VIDEO_FIT;
156+
break;
157+
}
158+
}
159+
138160
}

0 commit comments

Comments
 (0)