*** id: e59ebafa-35d6-4c9b-b003-be766e6bbf2d title: setLocalStream slug: /js/reference/video/room-session/set-local-stream description: setLocalStream method for the RoomSession class. max-toc-depth: 3 ---------------- ### setLocalStream * **setLocalStream**(`stream`): `void` Replaces the current local media stream with the one specified as a parameter. #### Parameters The media stream to use. #### Returns `void` #### Example Drawing and streaming the picture of a face: ```javascript const canvas = document.createElement("canvas"); const ctx = canvas.getContext("2d"); // Set canvas size canvas.width = 400; canvas.height = 400; // Draw circle ctx.beginPath(); ctx.arc(200, 200, 150, 0, 2 * Math.PI); ctx.fillStyle = "lightblue"; ctx.fill(); // Draw eyes ctx.beginPath(); ctx.arc(150, 150, 30, 0, 2 * Math.PI); ctx.arc(250, 150, 30, 0, 2 * Math.PI); ctx.fillStyle = "black"; ctx.fill(); // Get the media stream const stream = canvas.captureStream(25); // 25 FPS // Stream the canvas await roomSession.setLocalStream(stream); ```