{"id":20364337,"url":"https://github.com/bandwidth/webrtc-browser","last_synced_at":"2025-04-12T04:41:37.993Z","repository":{"id":42621909,"uuid":"273027526","full_name":"Bandwidth/webrtc-browser","owner":"Bandwidth","description":"Bandwidth's WebRTC Browser SDK","archived":false,"fork":false,"pushed_at":"2023-07-18T22:34:10.000Z","size":1274,"stargazers_count":7,"open_issues_count":17,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-10T15:58:03.384Z","etag":null,"topics":["bandwidth","outage-risk","sdk","webrtc"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bandwidth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-17T16:38:43.000Z","updated_at":"2022-12-14T23:19:22.000Z","dependencies_parsed_at":"2024-06-19T00:22:30.620Z","dependency_job_id":"3b888413-58f4-4dc9-ab6a-ba1bc32e10e8","html_url":"https://github.com/Bandwidth/webrtc-browser","commit_stats":{"total_commits":84,"total_committers":15,"mean_commits":5.6,"dds":0.8452380952380952,"last_synced_commit":"837d188307403cb6d9b8c65867b0b20f44a03d22"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bandwidth%2Fwebrtc-browser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bandwidth%2Fwebrtc-browser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bandwidth%2Fwebrtc-browser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bandwidth%2Fwebrtc-browser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bandwidth","download_url":"https://codeload.github.com/Bandwidth/webrtc-browser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248519304,"owners_count":21117756,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bandwidth","outage-risk","sdk","webrtc"],"created_at":"2024-11-15T00:11:21.358Z","updated_at":"2025-04-12T04:41:37.972Z","avatar_url":"https://github.com/Bandwidth.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bandwidth WebRTC Browser SDK Documentation\n\n## Initialize the Bandwidth WebRTC Browser SDK\n\n```javascript\nimport BandwidthRtc from \"@bandwidth/webrtc-browser\";\n\nconst bandwidthRtc = new BandwidthRtc();\n```\n\n## API Methods\n\n### connect\n\n- Params:\n  - authParams: the device token to connect with\n  - options: optional SDK settings (can be omitted)\n    - websocketUrl: override the default Bandwidth RTC connection url (this should not generally be needed)\n- Description: connect device to the Bandwidth RTC platform\n\n```javascript\nawait bandwidthRtc.connect({\n  deviceToken: deviceToken,\n});\n```\n\n### publish\n\n- Params:\n  - input: the input to publish; this can be an instance of:\n    - constraints: the media stream constraints such as audio, peerIdentity, video\n      - Type: MediaStreamConstraints\n    - mediaStream: An already existing media stream such as a screen share\n      - Type: MediaStream\n- Return:\n  - rtcStream: a media stream with the supplied media stream constraints\n    - Type: RtcStream\n- Description: publish media\n\n#### Publish with default settings:\n\n```javascript\nlet rtcStream: RtcStream = await bandwidthRtc.publish();\n```\n\n#### Publish audio only\n\n```javascript\nconst mediaConstraints: MediaStreamConstraints = {\n  audio: true,\n  video: false,\n};\nlet rtcStream: RtcStream = await bandwidthRtc.publish(mediaConstraints);\n```\n\n#### Publish with customized constraints\n\n```javascript\nconst mediaConstraints: MediaStreamConstraints = {\n  audio: {\n    autoGainControl: true,\n    channelCount: 1,\n    deviceId: \"default\",\n    echoCancellation: true,\n    latency: 0.01,\n    noiseSuppression: true,\n    sampleRate: 48000,\n    sampleSize: 16,\n  },\n  video: {\n    aspectRatio: 1.3333333333333333,\n    frameRate: 30,\n    width: { min: 640, ideal: 1280 },\n    height: { min: 480, ideal: 720 },\n    resizeMode: \"none\",\n  },\n};\nlet rtcStream: RtcStream = await bandwidthRtc.publish(mediaConstraints);\n```\n\n#### Publish with existing media stream\n\n```javascript\nlet screenShare = await navigator.mediaDevices.getDisplayMedia({\n  video: true,\n});\nlet rtcStream: RtcStream = await bandwidthRtc.publish(screenShare);\n```\n\nPlease see the following resources for more information on MediaStreamConstraints and MediaTrackConstraints that can be specified here:\n\n- https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints\n- https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints\n\n### disconnect\n\n- Description: disconnect device from the Bandwidth RTC platform\n\n### DTMF\n\n- Description: send a set of VoIP-network-friendly DTMF tones. The tone amplitude and duration can not be controlled\n- Params:\n  - tone: the digits to send, as a string, chosen from the set of valid DTMF characters [0-9,*,#,\\,]\n  - streamId (optional): the stream to 'play' the tone on\n\n```javascript\nbandwidthRtc.sendDtmf(\"3\");\nbandwidthRtc.sendDtmf(\"313,3211*#\");\n```\n\n## Event Listeners\n\n### onStreamAvailable\n\n- Description: called when a media stream is available to attach to the UI. This will be called for every independent stream presented to the Participant, meaning that if a new remote Participant is added to a subscribed Session a new stream will be made available to the browser, and will need to be presented to the UI for consumption by the user.\n\n```javascript\nbandwidthRtc.onStreamAvailable((event) =\u003e {\n  console.log(\n    `A stream is available with endpointId=${event.endpointId}, its media types are ${event.mediaTypes} and the stream itself is ${event.mediaStream}`\n  );\n});\n```\n\n### onStreamUnavailable\n\n- Description: called when a media stream is now unavailable and should be removed from the UI\n\n```javascript\nbandwidthRtc.onStreamUnavailable((event) =\u003e {\n  console.log(\n    `The stream with endpointId=${event.endpointId} is now unavailable and should be removed from the UI because the media is likely to freeze imminently.`\n  );\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbandwidth%2Fwebrtc-browser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbandwidth%2Fwebrtc-browser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbandwidth%2Fwebrtc-browser/lists"}