{"_id":"@c3voc/clappr-hlsjs-playback","name":"@c3voc/clappr-hlsjs-playback","dist-tags":{"latest":"1.1.1"},"versions":{"1.1.1":{"name":"@c3voc/clappr-hlsjs-playback","version":"1.1.1","description":"HLS Playback based on hls.js","main":"./dist/hlsjs-playback.js","module":"./dist/hlsjs-playback.esm.js","scripts":{"start":"SERVE=true rollup --config --watch","start:with-reload":"SERVE=true RELOAD=true rollup --config --watch","build":"rollup --config","watch":"rollup --config --watch","bundle-check":"ANALYZE_BUNDLE=true rollup --config","release":"MINIMIZE=true rollup --config","test":"jest ./src --coverage --silent","test:debug":"node --inspect node_modules/.bin/jest ./src --runInBand","test:watch":"jest ./src --watch","lint":"eslint *.js ./src","lint:fix":"yarn lint -- --fix","prepublishOnly":"npm run release"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+ssh://git@github.com/clappr/hlsjs-playback.git"},"author":{"name":"Globo.com"},"license":"BSD-3-Clause","bugs":{"url":"https://github.com/clappr/hlsjs-playback/issues"},"homepage":"https://github.com/clappr/hlsjs-playback","peerDependencies":{"@clappr/core":"^0.4.27","hls.js":"^1.4.10"},"devDependencies":{"@babel/core":"^7.14.2","@babel/preset-env":"^7.14.2","@clappr/core":"^0.4.27","@rollup/plugin-babel":"^5.3.0","@rollup/plugin-commonjs":"^19.0.0","@rollup/plugin-node-resolve":"^13.0.0","@rollup/plugin-replace":"^2.4.2","babel-jest":"^26.6.3","coveralls":"^3.1.0","cz-conventional-changelog":"^3.3.0","eslint":"^7.26.0","hls.js":"1.4.10","jest":"^26.6.3","rollup":"^2.47.0","rollup-plugin-filesize":"^9.1.1","rollup-plugin-livereload":"^2.0.0","rollup-plugin-serve":"^1.1.0","rollup-plugin-sizes":"^1.0.4","rollup-plugin-terser":"^7.0.2","rollup-plugin-visualizer":"^5.5.0"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"_id":"@c3voc/clappr-hlsjs-playback@1.1.1","contributors":[{"name":"Globo.com"}],"gitHead":"68c85526f61268a3ddd32e412e3dccd04de67f7a","_nodeVersion":"20.5.1","_npmVersion":"9.8.0","dist":{"integrity":"sha512-adY7uRjCVhIoSNO/EkylObnb9YePS7VWQNvmnWEqRzpHVnUpSUQaIHeaFOW0CNrCZf3CLPphyp8oTxAewFXOoQ==","shasum":"b543d4bef17742f076e687cb2e80c19b3d498d35","tarball":"https://registry.npmjs.org/@c3voc/clappr-hlsjs-playback/-/clappr-hlsjs-playback-1.1.1.tgz","fileCount":12,"unpackedSize":4482910,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDzy3jRDLLrnnr2nF9EL2BMG5OjPAo2+VX/Pu/pHcA8GwIhAOwQ5kYMbPfNsgiLomnYyAEoejfWFQ+k74tRZn0RxquR"}]},"_npmUser":{"name":"ischluff","email":"ischluff@mailbox.org"},"directories":{},"maintainers":[{"name":"ischluff","email":"ischluff@mailbox.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/clappr-hlsjs-playback_1.1.1_1692203195804_0.7894162423820055"},"_hasShrinkwrap":false}},"time":{"created":"2023-08-16T16:26:35.711Z","1.1.1":"2023-08-16T16:26:36.132Z","modified":"2023-08-16T16:26:36.455Z"},"maintainers":[{"name":"ischluff","email":"ischluff@mailbox.org"}],"description":"HLS Playback based on hls.js","homepage":"https://github.com/clappr/hlsjs-playback","repository":{"type":"git","url":"git+ssh://git@github.com/clappr/hlsjs-playback.git"},"contributors":[{"name":"Globo.com"}],"author":{"name":"Globo.com"},"bugs":{"url":"https://github.com/clappr/hlsjs-playback/issues"},"license":"BSD-3-Clause","readme":"# HlsjsPlayback\n\nA [Clappr](https://github.com/clappr/clappr) playback to play HTTP Live Streaming (HLS) based on the [hls.js](https://github.com/video-dev/hls.js).\n\n<p>\n  <a href=\"https://www.npmjs.com/package/@clappr/hlsjs-playback\"><img src=\"https://badge.fury.io/js/%40clappr%2Fhlsjs-playback.svg\"></a>\n  <a href=\"https://bundlephobia.com/result?p=@clappr/hlsjs-playback@latest\"><img src=\"https://img.shields.io/bundlephobia/min/@clappr/hlsjs-playback\"></a>\n  <a href=\"https://travis-ci.org/clappr/hlsjs-playback\"><img src=\"https://travis-ci.org/clappr/hlsjs-playback.svg?branch=master\"></a>\n  <a href=\"https://coveralls.io/github/clappr/hlsjs-playback?branch=master\"><img src=\"https://coveralls.io/repos/github/clappr/hlsjs-playback/badge.svg?branch=master\"></a>\n  <a href=\"https://github.com/clappr/hlsjs-playback/blob/master/LICENSE\"><img src=\"https://img.shields.io/badge/license-BSD--3--Clause-blue.svg\"></a>\n  <a href=\"https://www.jsdelivr.com/package/npm/@clappr/hlsjs-playback\"><img alt=\"jsDelivr hits (npm)\" src=\"https://img.shields.io/jsdelivr/npm/hm/@clappr/hlsjs-playback?color=orange\"></a>\n</p>\n\n\n## Usage\n\nYou can use it from JSDelivr:\n\n`https://cdn.jsdelivr.net/npm/@clappr/hlsjs-playback@latest/dist/hlsjs-playback.min.js`\n\nor as an npm package:\n\n`yarn add @clappr/hlsjs-playback`\n\nThen just add `HlsjsPlayback` into the list of plugins of your player instance:\n\n```javascript\nvar player = new Clappr.Player(\n  {\n    source: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8',\n    plugins: [HlsjsPlayback],\n  });\n```\n\n## Configuration\n\nThe options for this playback are shown below:\n\n```javascript\nvar player = new Clappr.Player(\n  {\n    source: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8',\n    plugins: [HlsjsPlayback],\n    hlsUseNextLevel: false,\n    hlsMinimumDvrSize: 60,\n    hlsRecoverAttempts: 16,\n    hlsPlayback: {\n      preload: true,\n      customListeners: [],\n    },\n    playback: {\n      extrapolatedWindowNumSegments: 2,\n      triggerFatalErrorOnResourceDenied: false,\n      hlsjsConfig: {\n        // hls.js specific options\n      },\n    },\n  });\n```\n\n#### hlsUseNextLevel\n> Default value: `false`\n\nThe default behavior for the HLS playback is to use [hls.currentLevel](https://github.com/video-dev/hls.js/blob/master/docs/API.md#hlscurrentlevel) to switch current level. To change this behaviour and force HLS playback to use [hls.nextLevel](https://github.com/video-dev/hls.js/blob/master/docs/API.md#hlsnextlevel), add `hlsUseNextLevel: true` to embed parameters.\n\n#### hlsMinimumDvrSize\n> Default value: `60 (seconds)`\n\nOption to define the minimum DVR size to active seek on Clappr live mode.\n\n#### extrapolatedWindowNumSegments\n> Default value: `2`\n\nConfigure the size of the start time extrapolation window measured as a multiple of segments.\n\nShould be 2 or higher, or 0 to disable. It should only need to be increased above 2 if more than one segment is removed from the start of the playlist at a time.\n\nE.g.: If the playlist is cached for 10 seconds and new chunks are added/removed every 5.\n\n#### hlsRecoverAttempts\n> Default value: `16`\n\nThe `hls.js` have recover approaches for some fatal errors. This option sets the max recovery attempts number for those errors.\n\n#### triggerFatalErrorOnResourceDenied\n> Default value: `false`\n\nIf this option is set to true, the playback will triggers fatal error event if decrypt key http response code is greater than or equal to 400. This option is used to attempt to reproduce iOS devices behaviour which internally use html5 video playback.\n\n#### hlsPlayback\n>  Soon (in a new breaking change version), all options related to this playback that are declared in the scope of the `options` object will have to be declared necessarily within this new scope!\n\nGroups all options related directly to `HlsjsPlayback` configs.\n\n```javascript\nvar player = new Clappr.Player(\n  {\n    ...\n    hlsPlayback: {\n      preload: true,\n      customListeners: [],\n    },\n  });\n```\n\n#### `hlsPlayback.preload`\n> Default value: `true`\n\nConfigures whether the source should be loaded as soon as the `HLS.JS` internal reference is setup or only after the first play.\n\n#### `hlsPlayback.customListeners`\n\nAn array of listeners object with specific parameters to add on `HLS.JS` instance.\n\n```javascript\nvar player = new Clappr.Player(\n  {\n    ...\n    hlsPlayback: {\n      ...\n      customListeners: [\n        // \"hlsFragLoaded\" is the value of HlsjsPlayback.HLSJS.Events.FRAG_LOADED constant.\n        { eventName: 'hlsFragLoaded', callback: (event, data) => { console.log('>>>>>> data: ', data) }, once: true }\n      ],\n    },\n  });\n```\n\nThe listener object parameters are:\n\n* `eventName`: A valid event name of `hls.js` [events API](https://github.com/video-dev/hls.js/blob/master/docs/API.md#runtime-events);\n* `callback`: The callback that should be called  when the event listened happen.\n* `once`: Flag to configure if the listener needs to be valid just for one time.\n\n#### hlsjsConfig\n\nAs `HlsjsPlayback` is based on `hls.js`, it's possible to use the available `hls.js` configs too. You can check them out [here](https://github.com/video-dev/hls.js/blob/master/docs/API.md#fine-tuning).\n\nTo use these settings, use the `hlsjsConfig` object.\n\nExample:\n\n```javascript\nvar player = new Clappr.Player(\n  {\n    ...\n    playback: {\n      hlsjsConfig: {\n        debug: true, // https://github.com/video-dev/hls.js/blob/master/docs/API.md#debug\n        enableworker: false, // https://github.com/video-dev/hls.js/blob/master/docs/API.md#enableworker\n        ...\n      },\n    },\n  });\n```\n\n## Development\n\nEnter the project directory and install the dependencies:\n\n`yarn install`\n\nMake your changes and run the tests:\n\n`yarn test`\n\nBuild your own version:\n\n`yarn build`\n\nCheck the result on `dist/` folder.\n\nStarting a local server:\n\n`yarn start`\n\nThis command will start an HTTP Server on port 8080. You can check a sample page with Clappr-core using the HlsjsPlayback on http://localhost:8080/\n","readmeFilename":"README.md"}