{"id":18035571,"url":"https://github.com/appleple/react-modal-video","last_synced_at":"2025-04-12T15:32:36.004Z","repository":{"id":16206111,"uuid":"79547915","full_name":"appleple/react-modal-video","owner":"appleple","description":"Accessible React Modal Video Component","archived":false,"fork":false,"pushed_at":"2023-07-28T05:53:16.000Z","size":2738,"stargazers_count":174,"open_issues_count":29,"forks_count":85,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-04-14T12:36:36.790Z","etag":null,"topics":["accessibility","es6","modal","react","ui-components","vimeo","youtube"],"latest_commit_sha":null,"homepage":"https://appleple.github.io/react-modal-video/","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/appleple.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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":"2017-01-20T10:01:49.000Z","updated_at":"2024-05-16T11:30:54.652Z","dependencies_parsed_at":"2024-05-16T11:30:43.858Z","dependency_job_id":"cd503743-30b3-480d-b130-baf18e603ad5","html_url":"https://github.com/appleple/react-modal-video","commit_stats":{"total_commits":106,"total_committers":23,"mean_commits":4.608695652173913,"dds":"0.46226415094339623","last_synced_commit":"8528b43b31bdd42a518f4fc563dbf386e155203d"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleple%2Freact-modal-video","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleple%2Freact-modal-video/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleple%2Freact-modal-video/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleple%2Freact-modal-video/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appleple","download_url":"https://codeload.github.com/appleple/react-modal-video/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248589840,"owners_count":21129689,"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":["accessibility","es6","modal","react","ui-components","vimeo","youtube"],"created_at":"2024-10-30T12:08:41.918Z","updated_at":"2025-04-12T15:32:35.976Z","avatar_url":"https://github.com/appleple.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-modal-video\n\nReact Modal Video Component\n\n## Features\n\n- Not affected by dom structure.\n- Beautiful transition\n- Accessible for keyboard navigation and screen readers.\n- Rich options for youtube API and Vimeo API\n\n## Demo\n\n[https://unpkg.com/react-modal-video@latest/test/index.html](https://unpkg.com/react-modal-video@latest/test/index.html)\n\n## Install\n\n### npm\n\n```sh\nnpm install react-modal-video\n```\n\n## Usage\n\nimport sass file to your project\n\n```scss\n@import 'node_modules/react-modal-video/scss/modal-video.scss';\n```\n\n### Functional Implementation with Hooks\n\n```jsx\nimport React, { useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport ModalVideo from 'react-modal-video';\n\nconst App = () =\u003e {\n  const [isOpen, setOpen] = useState(false);\n\n  return (\n    \u003cReact.Fragment\u003e\n      \u003cModalVideo\n\t\t\t\tchannel=\"youtube\"\n\t\t\t\tyoutube={{ mute: 0, autoplay: 0 }}\n\t\t\t\tisOpen={isOpen}\n\t\t\t\tvideoId=\"L61p2uyiMSo\"\n\t\t\t\tonClose={() =\u003e setOpen(false)} \n\t\t\t/\u003e\n      \u003cbutton className=\"btn-primary\" onClick={() =\u003e setOpen(true)}\u003e\n        VIEW DEMO\n      \u003c/button\u003e\n    \u003c/React.Fragment\u003e\n  );\n};\n\nReactDOM.render(\u003cApp /\u003e, document.getElementById('root'));\n```\n\n### Class Implementation\n\nchange \"isOpen\" property to open and close the modal-video\n\n```jsx\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport ModalVideo from 'react-modal-video';\n\nclass App extends React.Component {\n  constructor() {\n    super();\n    this.state = {\n      isOpen: false,\n    };\n    this.openModal = this.openModal.bind(this);\n  }\n\n  openModal() {\n    this.setState({ isOpen: true });\n  }\n\n  render() {\n    return (\n      \u003cReact.Fragment\u003e\n        \u003cModalVideo\n          channel=\"youtube\"\n          isOpen={this.state.isOpen}\n          videoId=\"L61p2uyiMSo\"\n          onClose={() =\u003e this.setState({ isOpen: false })}\n        /\u003e\n        \u003cbutton onClick={this.openModal}\u003eOpen\u003c/button\u003e\n      \u003c/React.Fragment\u003e\n    );\n  }\n}\n\nReactDOM.render(\u003cApp /\u003e, document.getElementById('root'));\n```\n\n## Options\n\n- About YouTube options, please refer to https://developers.google.com/youtube/player_parameters?hl=en\n- About Vimeo options, please refer to https://developer.vimeo.com/apis/oembed\n\n\u003ctable style=\"min-width:100%;\"\u003e\n\t\u003ctbody\u003e\u003ctr\u003e\n\t\t\u003cth colspan=\"2\"\u003eproperties\u003c/th\u003e\n\t\t\u003cth\u003edefault\u003c/th\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd colspan=\"2\"\u003echannel\u003c/td\u003e\n\t\t\u003ctd\u003e'youtube'\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd rowspan=\"23\"\u003eyoutube\u003c/td\u003e\n\t\t\u003ctd\u003eautoplay\u003c/td\u003e\n\t\t\u003ctd\u003e1\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003ecc_load_policy\u003c/td\u003e\n\t\t\u003ctd\u003e1\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003ecolor\u003c/td\u003e\n\t\t\u003ctd\u003enull\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003econtrols\u003c/td\u003e\n\t\t\u003ctd\u003e1\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003edisablekb\u003c/td\u003e\n\t\t\u003ctd\u003e0\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eenablejsapi\u003c/td\u003e\n\t\t\u003ctd\u003e0\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eend\u003c/td\u003e\n\t\t\u003ctd\u003enull\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003efs\u003c/td\u003e\n\t\t\u003ctd\u003e1\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eh1\u003c/td\u003e\n\t\t\u003ctd\u003enull\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eiv_load_policy\u003c/td\u003e\n\t\t\u003ctd\u003e1\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003elist\u003c/td\u003e\n\t\t\u003ctd\u003enull\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003elistType\u003c/td\u003e\n\t\t\u003ctd\u003enull\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eloop\u003c/td\u003e\n\t\t\u003ctd\u003e0\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003emodestbranding\u003c/td\u003e\n\t\t\u003ctd\u003enull\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eorigin\u003c/td\u003e\n\t\t\u003ctd\u003enull\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eplaylist\u003c/td\u003e\n\t\t\u003ctd\u003enull\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eplaysinline\u003c/td\u003e\n\t\t\u003ctd\u003enull\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003erel\u003c/td\u003e\n\t\t\u003ctd\u003e0\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eshowinfo\u003c/td\u003e\n\t\t\u003ctd\u003e1\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003estart\u003c/td\u003e\n\t\t\u003ctd\u003e0\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003ewmode\u003c/td\u003e\n\t\t\u003ctd\u003e'transparent'\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003etheme\u003c/td\u003e\n\t\t\u003ctd\u003e'dark'\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003emute\u003c/td\u003e\n\t\t\u003ctd\u003e0\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd rowspan=\"15\"\u003evimeo\u003c/td\u003e\n\t\t\u003ctd\u003eapi\u003c/td\u003e\n\t\t\u003ctd\u003efalse\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eautopause\u003c/td\u003e\n\t\t\u003ctd\u003etrue\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eautoplay\u003c/td\u003e\n\t\t\u003ctd\u003etrue\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003ebyline\u003c/td\u003e\n\t\t\u003ctd\u003etrue\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003ecallback\u003c/td\u003e\n\t\t\u003ctd\u003enull\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003ecolor\u003c/td\u003e\n\t\t\u003ctd\u003enull\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eheight\u003c/td\u003e\n\t\t\u003ctd\u003enull\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eloop\u003c/td\u003e\n\t\t\u003ctd\u003efalse\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003emaxheight\u003c/td\u003e\n\t\t\u003ctd\u003enull\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003emaxwidth\u003c/td\u003e\n\t\t\u003ctd\u003enull\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eplayer_id\u003c/td\u003e\n\t\t\u003ctd\u003enull\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eportrait\u003c/td\u003e\n\t\t\u003ctd\u003etrue\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003etitle\u003c/td\u003e\n\t\t\u003ctd\u003etrue\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003ewidth\u003c/td\u003e\n\t\t\u003ctd\u003enull\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003exhtml\u003c/td\u003e\n\t\t\u003ctd\u003efalse\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n        \u003ctd rowspan=\"2\"\u003eyouku\u003c/td\u003e\n        \u003ctd\u003eautoplay\u003c/td\u003e\n        \u003ctd\u003e1\u003c/td\u003e\n    \u003c/tr\u003e\n\t\u003ctr\u003e\n        \u003ctd\u003eshow_related\u003c/td\u003e\n        \u003ctd\u003e0\u003c/td\u003e\n    \u003c/tr\u003e\n\t\u003ctr\u003e\n        \u003ctd rowspan=\"1\"\u003ecustom\u003c/td\u003e\n        \u003ctd\u003eurl\u003c/td\u003e\n        \u003ctd\u003eMP4 URL / iframe URL\u003c/td\u003e\n    \u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd colspan=\"2\"\u003eratio\u003c/td\u003e\n\t\t\u003ctd\u003e'16:9'\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd colspan=\"2\"\u003eallowFullScreen\u003c/td\u003e\n\t\t\u003ctd\u003etrue\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd colspan=\"2\"\u003eanimationSpeed\u003c/td\u003e\n\t\t\u003ctd\u003e300\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd rowspan=\"6\"\u003eclassNames\u003c/td\u003e\n\t\t\u003ctd\u003emodalVideo\u003c/td\u003e\n\t\t\u003ctd\u003e'modal-video'\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003emodalVideoClose\u003c/td\u003e\n\t\t\u003ctd\u003e'modal-video-close'\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003emodalVideoBody\u003c/td\u003e\n\t\t\u003ctd\u003e'modal-video-body'\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003emodalVideoInner\u003c/td\u003e\n\t\t\u003ctd\u003e'modal-video-inner'\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003emodalVideoIframeWrap\u003c/td\u003e\n\t\t\u003ctd\u003e'modal-video-movie-wrap'\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003emodalVideoCloseBtn\u003c/td\u003e\n\t\t\u003ctd\u003e'modal-video-close-btn'\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd rowspan=\"2\"\u003earia\u003c/td\u003e\n\t\t\u003ctd\u003eopenMessage\u003c/td\u003e\n\t\t\u003ctd\u003e'You just opened the modal video'\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003edismissBtnMessage\u003c/td\u003e\n\t\t\u003ctd\u003e'Close the modal by clicking here'\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\n\n## FAQ\n\n### How to track YouTube videos playing in modal-video by GA4?\u003c/h3\u003e\n\n1. Enable JS API. Turn `enablejsapi` property to `1`.\n2. Load YouTube Iframe API. Add `\u003cscript src=\"https://www.youtube.com/iframe_api\"\u003e\u003c/script\u003e` in HTML file.\n\n## Licence\n\n[MIT](https://github.com/appleple/modal-video.js/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappleple%2Freact-modal-video","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappleple%2Freact-modal-video","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappleple%2Freact-modal-video/lists"}