{"id":28490984,"url":"https://github.com/videojs/plugin-concat","last_synced_at":"2025-07-08T01:31:34.897Z","repository":{"id":51260072,"uuid":"222557148","full_name":"videojs/plugin-concat","owner":"videojs","description":"Concatenate videos for playback by videojs/http-streaming in a Video.js player","archived":false,"fork":false,"pushed_at":"2021-05-18T18:13:23.000Z","size":902,"stargazers_count":13,"open_issues_count":4,"forks_count":4,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-06-08T07:44:11.847Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/videojs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-18T22:28:51.000Z","updated_at":"2025-06-08T00:46:49.000Z","dependencies_parsed_at":"2022-09-07T12:10:36.261Z","dependency_job_id":null,"html_url":"https://github.com/videojs/plugin-concat","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/videojs/plugin-concat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videojs%2Fplugin-concat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videojs%2Fplugin-concat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videojs%2Fplugin-concat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videojs%2Fplugin-concat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/videojs","download_url":"https://codeload.github.com/videojs/plugin-concat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videojs%2Fplugin-concat/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264175337,"owners_count":23568442,"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":"2025-06-08T07:30:59.222Z","updated_at":"2025-07-08T01:31:34.891Z","avatar_url":"https://github.com/videojs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# videojs-concat\n\nConcatenate videos for playback in a Video.js player\n\n## Table of Contents\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n\n- [Requirements](#requirements)\n  - [Test Page](#test-page)\n- [Installation](#installation)\n- [Usage](#usage)\n  - [`\u003cscript\u003e` Tag](#script-tag)\n  - [Browserify/CommonJS](#browserifycommonjs)\n  - [RequireJS/AMD](#requirejsamd)\n- [Method](#method)\n- [Limitations](#limitations)\n- [DRM](#drm)\n- [Examples](#examples)\n  - [Two of the same DASH source](#two-of-the-same-dash-source)\n  - [Two of the same HLS source](#two-of-the-same-hls-source)\n  - [Two of the same demuxed HLS source](#two-of-the-same-demuxed-hls-source)\n  - [Demuxed HLS and DASH](#demuxed-hls-and-dash)\n  - [HLS Widevine and DASH Widevine](#hls-widevine-and-dash-widevine)\n- [License](#license)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Requirements\n\nNote that this plugin requires the master branch of [VHS].\n\n### Test Page\n\nTo use the test page, clone [VHS], run:\n\n```sh\nnpm install\nnpm run build\nnpm link\n```\n\nThen in the plugin-concat directory, run:\n\n```sh\nnpm link @videojs/http-streaming\n```\n\n## Installation\n\n```sh\nnpm install --save @videojs/plugin-concat\n```\n\n## Usage\n\nTo include videojs-concat on your website or web application, use any of the following methods.\n\n### `\u003cscript\u003e` Tag\n\nThis is the simplest case. Get the script in whatever way you prefer and include the plugin _after_ you include [video.js][videojs], so that the `videojs` global is available.\n\n```html\n\u003cscript src=\"//path/to/video.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"//path/to/videojs-plugin-concat.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  var player = videojs('my-video');\n\n  player.concat(options);\n\u003c/script\u003e\n```\n\n### Browserify/CommonJS\n\nWhen using with Browserify, install videojs-concat via npm and `require` the plugin as you would any other module.\n\n```js\nvar videojs = require('video.js');\n\n// The actual plugin function is exported by this module, but it is also\n// attached to the `Player.prototype`; so, there is no need to assign it\n// to a variable.\nrequire('@videojs/plugin-concat');\n\nvar player = videojs('my-video');\n\nplayer.concat();\n```\n\n### RequireJS/AMD\n\nWhen using with RequireJS (or another AMD library), get the script in whatever way you prefer and `require` the plugin as you normally would:\n\n```js\nrequire(['video.js', '@videojs/plugin-concat'], function(videojs) {\n  var player = videojs('my-video');\n\n  player.concat(options);\n});\n```\n\n## Method\n\nvideojs-concat uses the standard VHS manifest parsers (m3u8-parser and mpd-parser at the moment) to create manifest objects from the downloaded manifests, then merges the JSON objects. The result can be passed as JSON via a data URI to VHS.\n\nTo use videojs-concat, all that needs to be done is to call the function `videojs.concat.concatenateVideos` and wait for the asynchronous operation to finish. The operation is asynchronous to allow for downloading of the manifests.\n\n## Limitations\n\n* Renditions must have both audio and video (though demuxed is supported in addition to muxed).\n* Only HLS and DASH are supported (at the moment).\n* Only one rendition is used per source.\n* Alternate audio is not supported (except demuxed with default audio playlists).\n* WebVTT subtitle playlists are not supported.\n\n## DRM\n\nDRM is supported via [videojs-contrib-eme].\n\nTo use DRM encrypted sources, add `keySystems` information to each encrypted manifest object in the same way as would be done for [videojs-contrib-eme]. See [the README](https://github.com/videojs/videojs-contrib-eme#setting-options-per-source) for details.\n\nNormally, licenses are requested for a video when segments are appended to the browser and the browser needs to decrypt the video. However, with multiple videos being concatenated, determining which key system information to use for the license request becomes challenging. Therefore, videojs-concat returns a function, `initializeKeySystems(player)` which sets up all of the key systems at once. `initializeKeySystems(player)` should be called after setting the source on the player. See [HLS Widevine and DASH Widevine] for an example.\n\n## Examples\n\n### Two of the same DASH source\n\n```js\nplayer.concat({\n  manifests: [{\n    url: 'https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd',\n    mimeType: 'application/dash+xml'\n  }, {\n    url: 'https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd',\n    mimeType: 'application/dash+xml'\n  }],\n  targetVerticalResolution: 720,\n  callback: (err, result) =\u003e {\n    if (err) {\n      console.error(err);\n      return;\n    }\n    console.log(result);\n    player.src({\n      src: `data:application/vnd.videojs.vhs+json,${JSON.stringify(result.manifestObject)}`,\n      type: 'application/vnd.videojs.vhs+json'\n    });\n  }\n});\n```\n\n### Two of the same HLS source\n\n```js\nplayer.concat({\n  manifests: [{\n    url: 'https://s3.amazonaws.com/_bc_dml/example-content/bipbop-advanced/bipbop_16x9_variant.m3u8',\n    mimeType: 'application/x-mpegURL'\n  }, {\n    url: 'https://s3.amazonaws.com/_bc_dml/example-content/bipbop-advanced/bipbop_16x9_variant.m3u8',\n    mimeType: 'application/x-mpegURL'\n  }],\n  targetVerticalResolution: 720,\n  callback: (err, result) =\u003e {\n    if (err) {\n      console.error(err);\n      return;\n    }\n    console.log(result);\n    player.src({\n      src: `data:application/vnd.videojs.vhs+json,${JSON.stringify(result.manifestObject)}`,\n      type: 'application/vnd.videojs.vhs+json'\n    });\n  }\n});\n```\n\n### Two of the same demuxed HLS source\n\n```js\nplayer.concat({\n  manifests: [{\n    url: 'http://storage.googleapis.com/shaka-demo-assets/angel-one-hls/hls.m3u8',\n    mimeType: 'application/x-mpegURL'\n  }, {\n    url: 'http://storage.googleapis.com/shaka-demo-assets/angel-one-hls/hls.m3u8',\n    mimeType: 'application/x-mpegURL'\n  }],\n  targetVerticalResolution: 720,\n  callback: (err, result) =\u003e {\n    if (err) {\n      console.error(err);\n      return;\n    }\n    console.log(result);\n    player.src({\n      src: `data:application/vnd.videojs.vhs+json,${JSON.stringify(result.manifestObject)}`,\n      type: 'application/vnd.videojs.vhs+json'\n    });\n  }\n});\n```\n\n### Demuxed HLS and DASH\n\n```js\nplayer.concat({\n  manifests: [{\n    url: 'http://storage.googleapis.com/shaka-demo-assets/angel-one-hls/hls.m3u8',\n    mimeType: 'application/x-mpegURL'\n  }, {\n    url: 'https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd',\n    mimeType: 'application/dash+xml'\n  }],\n  targetVerticalResolution: 720,\n  callback: (err, result) =\u003e {\n    if (err) {\n      console.error(err);\n      return;\n    }\n    console.log(result);\n    player.src({\n      src: `data:application/vnd.videojs.vhs+json,${JSON.stringify(result.manifestObject)}`,\n      type: 'application/vnd.videojs.vhs+json'\n    });\n  }\n});\n```\n\n### HLS Widevine and DASH Widevine\n\n```js\n// initialize videojs-conrib-eme if it hasn't been initialized already\nplayer.eme();\nplayer.concat({\n  manifests: [{\n    url: 'https://amssamples.streaming.mediaservices.windows.net/622b189f-ec39-43f2-93a2-201ac4e31ce1/BigBuckBunny.ism/manifest(format=mpd-time-csf)',\n    mimeType: 'application/dash+xml',\n    keySystems: {\n      'com.widevine.alpha': 'https://amssamples.keydelivery.mediaservices.windows.net/Widevine/?KID=1ab45440-532c-4399-94dc-5c5ad9584bac'\n    }\n  }, {\n    url: 'https://storage.googleapis.com/shaka-demo-assets/angel-one-widevine-hls/hls.m3u8',\n    mimeType: 'application/x-mpegURL',\n    keySystems: {\n      'com.widevine.alpha': 'https://cwip-shaka-proxy.appspot.com/no_auth'\n    }\n  }],\n  targetVerticalResolution: 720,\n  callback: (err, result) =\u003e {\n    if (err) {\n      console.error(err);\n      return;\n    }\n    console.log(result);\n    player.src({\n      src: `data:application/vnd.videojs.vhs+json,${JSON.stringify(result.manifestObject)}`,\n      type: 'application/vnd.videojs.vhs+json'\n    });\n    result.initializeKeySystems(player);\n  }\n});\n```\n\n## License\n\nApache-2.0. Copyright (c) Brightcove, Inc\n\n\n[videojs]: http://videojs.com/\n[videojs-contrib-eme]: https://github.com/videojs/videojs-contrib-eme\n[VHS]: https://github.com/videojs/http-streaming\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvideojs%2Fplugin-concat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvideojs%2Fplugin-concat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvideojs%2Fplugin-concat/lists"}