{"id":15601155,"url":"https://github.com/hacknlove/wsvideo","last_synced_at":"2026-07-02T17:34:15.175Z","repository":{"id":57400161,"uuid":"87402137","full_name":"hacknlove/wsvideo","owner":"hacknlove","description":"websocket streaming html5 video","archived":false,"fork":false,"pushed_at":"2017-09-29T07:53:39.000Z","size":70,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-13T02:07:15.855Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/hacknlove.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":"2017-04-06T07:54:49.000Z","updated_at":"2017-08-28T19:35:58.000Z","dependencies_parsed_at":"2022-09-05T03:41:18.450Z","dependency_job_id":null,"html_url":"https://github.com/hacknlove/wsvideo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacknlove%2Fwsvideo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacknlove%2Fwsvideo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacknlove%2Fwsvideo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacknlove%2Fwsvideo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hacknlove","download_url":"https://codeload.github.com/hacknlove/wsvideo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240371751,"owners_count":19790888,"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":[],"created_at":"2024-10-03T02:18:50.852Z","updated_at":"2025-10-31T09:49:05.416Z","avatar_url":"https://github.com/hacknlove.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wsvideo\nwebsocket streaming html5 video\n\n`npm install --save wsvideo`\n\n`bower install --save wsvideo`\n\n## Howto client-side\n```\nvar video = document.querySelector('video')\n\nwsvideo('ws://example.com/foo', video)\n\n```\n\n## Howto server-side (node example)\n\n```\nconst WebSocket = require('ws')\nconst url = require('url')\n...\n\nvar streamVideo = function (ws, path, query) {\n  var paused = false\n  var options = {}\n  if (query.start !== undefined) {\n    options.start = query.start * 1\n  }\n  if (query.end * 1) {\n    options.end = query.end * 1\n  }\n\n  ///\n  var stream = CREATE_SOME_READ_STREAM_OF_THE_VIDEO_path_BETWEEN_options.start_AND_options.edn\n  ///\n\n  ws.on('close', function () {\n    stream.destroy()\n  })\n  stream.on('data', function (chunk) {\n    if (ws.readyState === WebSocket.OPEN) {\n      ws.send(chunk)\n    }\n    stream.pause()\n    // WE WANT TO SEND NOT TOO FAST\n    setTimeout(function () {\n      if (!paused) {\n        stream.resume()\n      }\n    }, 100)\n  })\n  ws.on('message', function (data) {\n    if (data === 'wait') {\n      paused = true\n      stream.pause()\n      return\n    }\n    if (data === 'continue') {\n      paused = false\n      return stream.resume()\n    }\n  })\n  stream.on('end', function () {\n    ws.close()\n  })\n}\n\n\nwebsocketserver.on('connection', function connection (ws) {\n  const location = url.parse(ws.upgradeReq.url, true)\n  return streamVideo(ws, location.pathname, location.query)\n})\n\n```\n\n## TODO\n\nUpload a server side\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhacknlove%2Fwsvideo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhacknlove%2Fwsvideo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhacknlove%2Fwsvideo/lists"}