Skip to content

Commit

Permalink
updates screen-share code and docs and other typo fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
conshus committed Apr 7, 2023
1 parent 69cbbe6 commit 77e9251
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
5 changes: 2 additions & 3 deletions screen-share/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ npm i @vonage/screen-share

### Attributes that can be used (optional):

- `width` : set the width of the screen share preview. Can be in pixels (ex: "360px") or a percentage (ex: "75%"). Default is "100%".
- `height` : set the height of the screen share preview. Can be in pixels (ex: "240px") or a percentage (ex: "55%"). Default is "100%".
- `properties` : (Object) the properties used to publish the screen share. Find the full list in the [documentation](https://tokbox.com/developer/sdks/js/reference/OT.html#initPublisher).
- `start-text` : set the text of the button to begin screen sharing. Default is "start screenshare".
- `stop-text` : set the text of the button to end screen sharing. Default is "stop screenshare".

```html
<screen-share start-text="start" stop-text="stop" width="300px" height="240px"></screen-share>
<screen-share start-text="start" stop-text="stop"></screen-share>
```

## Styling
Expand Down
2 changes: 1 addition & 1 deletion screen-share/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": "https://github.com/opentok/web-components/tree/main/screen-share",
"license": "MIT",
"author": "Vonage",
"version": "0.0.2",
"version": "0.0.3",
"main": "index.js",
"module": "index.js",
"scripts": {
Expand Down
15 changes: 4 additions & 11 deletions screen-share/src/ScreenShare.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export class ScreenShare extends LitElement {
publisher: {},
session: {},
token: {},
width: {type: String},
height: {type: String},
properties: { type: Object },
buttonStartText: { type: String, attribute: 'start-text' },
buttonStopText: { type: String, attribute: 'stop-text' },
isSharing: { type: Boolean }
Expand All @@ -28,8 +27,7 @@ export class ScreenShare extends LitElement {
super();
this.session = {};
this.token = "";
this.width = "100%";
this.height = "100%";
this.properties = {};
this.buttonStartText = "start screenshare";
this.buttonStopText = "stop screenshare";
this.isSharing = false;
Expand All @@ -51,14 +49,9 @@ export class ScreenShare extends LitElement {
}

async __handleStartScreenshare() {
const publisherOptions = {
insertMode: 'append',
width: this.width,
height: this.height,
videoSource: 'screen'
};
this.properties = { ...this.properties, videoSource: 'screen', insertMode: 'append'};
if (window.OT){
this.publisher = OT.initPublisher(document.querySelector('screen-share'),publisherOptions, (error) => {
this.publisher = OT.initPublisher(document.querySelector('screen-share'), this.properties, (error) => {
if(error){
console.error("error: ", error)
} else {
Expand Down
2 changes: 1 addition & 1 deletion video-subscriber/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ npm i @vonage/video-subscriber

### Attributes that can be used (optional):

- `properties` : (Object) the properties used to initialize the publisher. Find the full list in the [documentation](https://tokbox.com/developer/sdks/js/reference/OT.html#initPublisher).
- `properties` : (Object) the properties used to initialize the subscriber. Find the full list in the [documentation](https://tokbox.com/developer/sdks/js/reference/Session.html#subscribe).

### Methods that can be called

Expand Down
2 changes: 1 addition & 1 deletion video-subscribers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ npm i @vonage/video-subscribers

### Attributes that can be used (optional):

- `properties` : (Object) the properties used pn each video in video subscribers. Find the full list in the [documentation](https://tokbox.com/developer/sdks/js/reference/OT.html#initPublisher).
- `properties` : (Object) the properties used on each video in video subscribers. Find the full list in the [documentation](https://tokbox.com/developer/sdks/js/reference/Session.html#subscribe).

## Getting it to work

Expand Down

0 comments on commit 77e9251

Please sign in to comment.