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

Commit

Permalink
Merge pull request #40 from tushar-1health/master
Browse files Browse the repository at this point in the history
Default render style in subscriber
  • Loading branch information
triniwiz authored May 10, 2017
2 parents a7f38be + 20fd412 commit 3abdaff
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
26 changes: 24 additions & 2 deletions src/android/subscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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){
Expand Down Expand Up @@ -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;
}
}

}

0 comments on commit 3abdaff

Please sign in to comment.