For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
ReferenceGuidesClick-to-Call
ReferenceGuidesClick-to-Call
  • Core
    • Overview
  • SignalWire Client
    • Overview
    • Notifications
    • Client
    • Utility functions
  • Video
    • Overview
    • LocalOverlay
    • RoomSession
      • Events
        • addCamera
        • addDevice
        • addMicrophone
        • audioMute
        • audioUnmute
        • createScreenShareObject
        • deaf
        • deleteMemberMeta
        • deleteMeta
        • demote
        • destroy
        • getLayouts
        • getMemberMeta
        • getMembers
        • getMeta
        • getPlaybacks
        • getRecordings
        • getStreams
        • hangupAll
        • hideVideoMuted
        • join
        • leave
        • lock
        • off
        • on
        • once
        • play
        • promote
        • removeAllListeners
        • removeAllMembers
        • removeMember
        • sendDigits
        • setHideVideoMuted
        • setInputSensitivity
        • setInputVolume
        • setLayout
        • setLocalStream
        • setMemberMeta
        • setMemberPosition
        • setMeta
        • setOutputVolume
        • setPositions
        • setPrioritizeHandraise
        • setRaisedHand
        • showVideoMuted
        • startRecording
        • startScreenShare
        • startStream
        • undeaf
        • unlock
        • updateCamera
        • updateMemberMeta
        • updateMeta
        • updateMicrophone
        • updateSpeaker
        • videoMute
        • videoUnmute
    • RoomSessionDevice
    • RoomSessionPlayback
    • RoomSessionRecording
    • RoomSessionScreenShare
    • RoomSessionStream
    • RoomDevice
    • RoomScreenShare
  • Chat
    • Overview
    • Client
    • ChatMember
    • ChatMemberEntity
    • ChatMessage
    • ChatMessageEntity
  • PubSub
    • Overview
    • Client
    • PubSubMessage
  • WebRTC
    • Overview
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • setLocalStream
VideoRoomSessionMethods

setLocalStream

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

setMemberMeta

Next
Built with

setLocalStream

  • setLocalStream(stream): void

Replaces the current local media stream with the one specified as a parameter.

Parameters

stream
MediaStream

The media stream to use.

Returns

void

Example

Drawing and streaming the picture of a face:

1const canvas = document.createElement("canvas");
2const ctx = canvas.getContext("2d");
3
4// Set canvas size
5canvas.width = 400;
6canvas.height = 400;
7
8// Draw circle
9ctx.beginPath();
10ctx.arc(200, 200, 150, 0, 2 * Math.PI);
11ctx.fillStyle = "lightblue";
12ctx.fill();
13
14// Draw eyes
15ctx.beginPath();
16ctx.arc(150, 150, 30, 0, 2 * Math.PI);
17ctx.arc(250, 150, 30, 0, 2 * Math.PI);
18ctx.fillStyle = "black";
19ctx.fill();
20
21// Get the media stream
22const stream = canvas.captureStream(25); // 25 FPS
23
24// Stream the canvas
25await roomSession.setLocalStream(stream);