{"id":13908194,"url":"https://github.com/matvp91/shaka-player-react","last_synced_at":"2025-04-07T05:10:29.018Z","repository":{"id":35821152,"uuid":"219521132","full_name":"matvp91/shaka-player-react","owner":"matvp91","description":"A simple React component wrapper for shaka-player","archived":false,"fork":false,"pushed_at":"2023-04-10T10:53:56.000Z","size":683,"stargazers_count":114,"open_issues_count":12,"forks_count":34,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-31T04:08:04.607Z","etag":null,"topics":["audio","dash","drm","encrypted-media","hls","javascript","media-source-extension","mse","playback","player","react","react-hooks","video","video-player","video-streaming"],"latest_commit_sha":null,"homepage":"","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/matvp91.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2019-11-04T14:30:05.000Z","updated_at":"2025-03-10T09:29:32.000Z","dependencies_parsed_at":"2024-10-30T00:20:48.585Z","dependency_job_id":null,"html_url":"https://github.com/matvp91/shaka-player-react","commit_stats":{"total_commits":39,"total_committers":3,"mean_commits":13.0,"dds":"0.20512820512820518","last_synced_commit":"685ddde53df52a428daf37646b2ec3ab8f4bad2e"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matvp91%2Fshaka-player-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matvp91%2Fshaka-player-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matvp91%2Fshaka-player-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matvp91%2Fshaka-player-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matvp91","download_url":"https://codeload.github.com/matvp91/shaka-player-react/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247595335,"owners_count":20963943,"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":["audio","dash","drm","encrypted-media","hls","javascript","media-source-extension","mse","playback","player","react","react-hooks","video","video-player","video-streaming"],"created_at":"2024-08-06T23:02:32.371Z","updated_at":"2025-04-07T05:10:28.998Z","avatar_url":"https://github.com/matvp91.png","language":"JavaScript","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"# Shaka Player React\n\nA React component for [Shaka Player](https://github.com/google/shaka-player), an open-source JavaScript library for adaptive media. It is highly recommended to check the official shaka documentation first.\n\n## Installation\n\n`npm install shaka-player-react --save`\n\n`yarn add shaka-player-react`\n\n## Usage\n\nAs seen in the example below, the CSS bundled with `shaka-player` has been imported separately. This is because `shaka-player-react` does not require any CSS internally, which keeps you in full control of the styling as if you were not using this React wrapper.\n\n```javascript\nimport React from 'react';\nimport ShakaPlayer from 'shaka-player-react';\nimport 'shaka-player-react/dist/controls.css';\n\nfunction App() {\n  return \u003cShakaPlayer autoPlay src=\"https://streams.com/example.mpd\" /\u003e;\n}\n```\n\nThe following `ShakaPlayer` properties are supported:\n\n| Property     | Description                                                                                 | Type    |\n| ------------ | ------------------------------------------------------------------------------------------- | ------- |\n| src          | The MPEG-DASH, or HLS media asset. Is provided to `shaka.Player.load` on mount or change.   | String  |\n| autoPlay     | Whether the asset should autoplay or not, directly bound to the `HTMLVideoElement` element. | Boolean |\n| width        | Width of the player.                                                                        | Number  |\n| height       | Height of the player.                                                                       | Number  |\n| playbackRate | Sets the speed of the audio/video playback.                                                 | Number  |\n| muted        | Sets whether the video is muted or not                                                      | Boolean |\n| loop         | Sets whether teh audio/video should start over again when finished                          | Boolean |\n| volume       | Sets the volume of the audio/video                                                          | Number  |\n| className    | Adds a class to the root element, which is a div.                                           | String  |\n\n### Access shaka's player object.\n\nThe following is a more advanced setup to illustrate how you can integrate shaka's features in React.\n\n```javascript\nimport React, { useRef, useEffect } from 'react';\nimport ShakaPlayer from 'shaka-player-react';\n\nfunction App() {\n  const controllerRef = useRef(null);\n\n  useEffect(() =\u003e {\n    const {\n      /** @type {shaka.Player} */ player,\n      /** @type {shaka.ui.Overlay} */ ui,\n      /** @type {HTMLVideoElement} */ videoElement\n    } = controllerRef.current;\n\n    async function loadAsset() {\n      // Load an asset.\n      await player.load('https://streams.com/example.mpd');\n\n      // Trigger play.\n      videoElement.play();\n    }\n\n    loadAsset();\n  }, []);\n\n  return \u003cShakaPlayer ref={controllerRef} /\u003e;\n}\n```\n\nOr check the [example](https://github.com/matvp91/shaka-player-react/tree/master/example) in this repository.\n\n## Integrate with\n\n### Next.js\n\n```javascript\nimport React from 'react';\nimport dynamic from 'next/dynamic';\n\nconst ShakaPlayer = dynamic(() =\u003e import('shaka-player-react'), { ssr: false });\n\nexport default function Index() {\n  return (\n    \u003cdiv\u003e\n      \u003cShakaPlayer autoPlay src=\"https://streams.com/example.mpd\" /\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\nWhen using `next/dynamic` with `{ ssr: false }`, we'll make sure the component is not interpreted by Next.js SSR. As of today, pre-rendering shaka-player's UI is technically not possible due to the fact that it is not written in React (but in plain Javascript). Although, shaka-player heavily relies on browser API's and serves no real purpose on a backend anyways.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatvp91%2Fshaka-player-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatvp91%2Fshaka-player-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatvp91%2Fshaka-player-react/lists"}