{"id":23552721,"url":"https://github.com/meething/streamswitcher","last_synced_at":"2026-03-12T03:32:20.914Z","repository":{"id":114419566,"uuid":"272681409","full_name":"meething/StreamSwitcher","owner":"meething","description":"Allows MediaStream to switch tracks without setting srcObject this allows MediaRecording to continue recording","archived":false,"fork":false,"pushed_at":"2020-06-21T16:33:44.000Z","size":4943,"stargazers_count":31,"open_issues_count":1,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-28T13:57:15.841Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://meething.github.io/StreamSwitcher/","language":"JavaScript","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/meething.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-16T10:44:50.000Z","updated_at":"2024-06-25T22:19:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"86d23fa2-323c-4ece-a2f2-2d8c85869cf8","html_url":"https://github.com/meething/StreamSwitcher","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/meething/StreamSwitcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meething%2FStreamSwitcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meething%2FStreamSwitcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meething%2FStreamSwitcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meething%2FStreamSwitcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meething","download_url":"https://codeload.github.com/meething/StreamSwitcher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meething%2FStreamSwitcher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30414307,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T00:40:14.898Z","status":"online","status_checked_at":"2026-03-12T02:00:07.260Z","response_time":114,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-12-26T11:13:04.278Z","updated_at":"2026-03-12T03:32:20.899Z","avatar_url":"https://github.com/meething.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# StreamSwitcher\nAllows MediaStream to switch tracks without setting srcObject this allows MediaRecording to continue recording.\n\n## [Demo](https://meething.github.io/StreamSwitcher/)\n\n## Problem\nThe MediaRecorder is designed to stop recording when you switch streams during recording.\n\n## Solution\nUse RTCPSender to switch stream without MediaRecorder to stop recording. Another solution would be using MediaSourceBuffers but that is way more error sensitive in case of different codes etc.. \n\n## Result\nA stream where you switch for instance camera with screenshare and back without need to stop and start the MediaRecorder\n\n## How to use it\nHTML file\n```\n\u003chead\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/gh/meething/StreamSwitcher@latest/js/ReplaceableMediaStream.js\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n```\nJS file\n```\n//Setup video with empty stream\nvar temporaryStream = new MediaStream();\nvideo.srcObject = temporaryStream.remoteStream;\n\n//Change the track from a stream\nvideo.srcObject.replaceVideoTrack(stream.getVideoTracks()[0])//Video\nvideo.srcObject.replaceAudioTrack(stream.getAudioTracks()[0])//Audio\n\n//If not autoplay\nvideo.play();\n```\n\n## Resource\n- https://discourse.mozilla.org/t/switch-stream-in-media-recorder/27619/3\n- https://stackoverflow.com/questions/59846230/mediarecorder-switch-video-tracks\n- https://webrtc.github.io/samples/src/content/peerconnection/pc1/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeething%2Fstreamswitcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeething%2Fstreamswitcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeething%2Fstreamswitcher/lists"}