{"id":44333974,"url":"https://github.com/zhutao315/videortp","last_synced_at":"2026-02-11T11:01:03.491Z","repository":{"id":42837203,"uuid":"264381173","full_name":"zhutao315/videoRTP","owner":"zhutao315","description":"Compression and  upload video to server","archived":false,"fork":false,"pushed_at":"2023-01-06T06:03:08.000Z","size":467,"stargazers_count":10,"open_issues_count":8,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-09T13:18:27.594Z","etag":null,"topics":["blobs","press-video","record-video","webrtc"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhutao315.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-16T07:15:25.000Z","updated_at":"2024-10-20T11:03:24.000Z","dependencies_parsed_at":"2023-02-05T12:00:41.886Z","dependency_job_id":null,"html_url":"https://github.com/zhutao315/videoRTP","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/zhutao315/videoRTP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhutao315%2FvideoRTP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhutao315%2FvideoRTP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhutao315%2FvideoRTP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhutao315%2FvideoRTP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhutao315","download_url":"https://codeload.github.com/zhutao315/videoRTP/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhutao315%2FvideoRTP/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29332292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T06:13:03.264Z","status":"ssl_error","status_checked_at":"2026-02-11T06:12:55.843Z","response_time":97,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["blobs","press-video","record-video","webrtc"],"created_at":"2026-02-11T11:00:23.076Z","updated_at":"2026-02-11T11:01:03.475Z","avatar_url":"https://github.com/zhutao315.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [video-rtp](https://github.com/zhutao315/videoRTP)\n\n[![npm](https://img.shields.io/npm/v/video-rtp.svg)](https://www.npmjs.com/package/video-rtp)\n\nA cross-browser implementation to record video on real time\n\n\u003e \u003cbr\u003e1. Use webRTC/mediaRecord first \u003cbr\u003e2. Degrade to use \"input[type = file]\" when not support webRTC\n\nvideo-rtp can open the camera and record video to a series of blobs.\nYou can upload the recorded blobs in realtime to the server! Or you can get the blobs and combine to a smaller video after specific time-intervals.\n\n## Browser Support\n\nAccording to webRTC/MediaRecord/Canvas's compatibility\n\n| Browser        | Support           | Features |\n| ------------- |-------------|-------------|\n| Firefox | mobile / PC | webRTC to webm |\n| Google Chrome | mobile / PC | webRTC to webm |\n| Opera | mobile / PC | mobile: canvas to webp, PC: webRTC to webm |\n| Android | ALL | Chrome: webRTC to webm, Other: canvas to webp |\n| Microsoft Edge | Suggest: rtmp-streamer | canvas to webp |\n| Safari 11 | mobile / PC | canvas to webp now |\n\n\u003e There is a similar project: **RecordRTC**! [Demo](https://www.webrtc-experiment.com/RecordRTC/)\n\n## How to use it\n\nYou can [install scripts using NPM](https://www.npmjs.com/package/video-rtp):\n\n```javascript\nnpm install video-rtp\n```\n\n## Record video\n\n```javascript\nimport {webrtcSurport, openVideo} from 'video-rtp'\n\nfunction getSocket(isRTC) {\n    let url = `ws://localhost:3000/${isRTC ? 'webm' : 'webp'}`\n    const ws = new WebSocket(url);\n    return new Promise(resolve =\u003e {\n    ws.onopen = () =\u003e resolve(ws)\n    })\n},\n\nconst wsP = getSocket(webrtcSurport())\n\nconst record = await openVideo({\n    video: document.getElementById('webrtc'),\n    duration: 100,\n    MINSIZE: 1024,\n    chunks(chunk) {\n    // sender chunks\n    console.log('sender chunks', chunk)\n    wsP.then(ws =\u003e ws.send(chunk))\n    },\n    ended() {\n    // record chunks ended, You can save video in this function.\n    console.log('record chunks ended')\n    wsP.then(ws =\u003e ws.send(0))\n    },\n    degrade:true // 不支持webRTC则降级处理打开本地视频\n})\n\n```\n\n## How to save recordings?\n\n```javascript\nimport {webrtcSurport, openVideo} from 'video-rtp'\nimport Whammy from 'whammy'\n\nlet video = null\nconst encoder = new Whammy.Video(15);\nopenVideo({\n    /* .....*/\n    chunks(blobs, canvas) {\n        // save webm/webp to blobs\n        encoder.add(canvas)\n    },\n    ended() {\n        // create video by blobs\n        if (webrtcSurport()) {\n            video = new Blob(blobs, {type: 'video/webm;codecs=vp9'});\n        }else {\n            video = encoder.compile()\n        }\n    },\n    degrade:document.getElementById('p') // 不支持webRTC则降级处理打开本地视频\n})\n```\n\n## DEMO\n\nLocal video compression and upload\n\nWEB push and pull stream, mock live broadcast\n\n[https://github.com/zhutao315/videoRTP-example](https://github.com/zhutao315/videoRTP-example)\n\n```\nnpm install \u0026\u0026 npm start\n```\n\nopen localhost:3000\n\n\n# API Documentation\n\n| Name                   | Type          | Default       | Description                                                                                                                                               |\n| ---------------| ------------- | ------------- | ---------------------------------------------------------------|\n| `video`        |  String/DOM  |       -       | Display video recorded by the camera |\n| `duration`        |  Number  |       100(ms)       | The time interval when Canvas draws frames |\n| `collectTime`        |  Number  |       1000(ms)      | The time length of chunks by mediaRecord record |\n| `MINSIZE`        |  Number  |       1M       | If the video size is lower than this value, the video will be returned without processing |\n| `MAXTIME`        |  Number  |       15(m)      | The Maximum duration of the upload video  |\n| `chunks`        |  Function  |       () =\u003e { }       | The callback Function executed each time when the screen is recorded.\u003cbr\u003e The param is a blob and the blob's type is webm/webp |\n| `ended`        |  Function  |       () =\u003e { }       | The callback Function executed when the record is end |\n| `degrade`        |  String/DOM/Boolen  |       -       | The degrage is usefull when the webRTC is not supported |\n\n\n\u003e When the \"degrade\" is a string, the component will find the DOM by id/class. The dom will bind a click event to open the local video. When the value of \"degrade\" is true, the openVideo function will open the local video directly. \n\n\n## How to manually stop recordings?\n\n```javascript\nrecord.stop();\n```\n\n## How to pause recordings?\n\n```javascript\nrecord.pause();\n```\n\n## How to resume recordings?\n\n```javascript\nrecord.resume();\n```\n\n## License\n\nIf you have any Suggestions, let me know. Thanks!\nMIT licence\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhutao315%2Fvideortp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhutao315%2Fvideortp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhutao315%2Fvideortp/lists"}