{"id":13733684,"url":"https://github.com/YagoLopez/vrview-react","last_synced_at":"2025-05-08T09:33:00.411Z","repository":{"id":82896610,"uuid":"99969916","full_name":"YagoLopez/vrview-react","owner":"YagoLopez","description":":star: Virtual Reality React Component for 360º photos, videos and virtual tour visualization","archived":false,"fork":false,"pushed_at":"2018-02-14T21:31:58.000Z","size":37607,"stargazers_count":43,"open_issues_count":0,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-06T03:33:20.907Z","etag":null,"topics":["360-photo","360-video","360photo","360video","photosphere","virtual-reality","vrview"],"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/YagoLopez.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}},"created_at":"2017-08-10T22:33:02.000Z","updated_at":"2025-03-31T02:27:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"2814a1ae-61b1-4db4-80c9-5d9021b1bf8e","html_url":"https://github.com/YagoLopez/vrview-react","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/YagoLopez%2Fvrview-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YagoLopez%2Fvrview-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YagoLopez%2Fvrview-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YagoLopez%2Fvrview-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YagoLopez","download_url":"https://codeload.github.com/YagoLopez/vrview-react/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253036798,"owners_count":21844287,"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":["360-photo","360-video","360photo","360video","photosphere","virtual-reality","vrview"],"created_at":"2024-08-03T03:00:47.437Z","updated_at":"2025-05-08T09:32:56.913Z","avatar_url":"https://github.com/YagoLopez.png","language":"JavaScript","readme":"\u003cp align=\"center\"\u003e\n\n  \u003ca href=\"https://travis-ci.org/YagoLopez/vrview-react\" title=\"Build Status\"\u003e\n    \u003cimg src=\"https://travis-ci.org/YagoLopez/vrview-react.svg?branch=master\" /\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://codeclimate.com/github/YagoLopez/vrview-react/maintainability\"\u003e\n    \u003cimg src=\"https://api.codeclimate.com/v1/badges/c294fc94b8d840217b1c/maintainability\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://yagolopez.js.org/vrview-react/deps/deps.html\" title=\"Dependencies Analysis\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/dependencies-analysis-blue.svg\" /\u003e\n  \u003c/a\u003e\n\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"360.jpg\" /\u003e\u003c/p\u003e\n\n# \u003cp align=\"center\"\u003eVRVIEW React\u003c/p\u003e\n\n\u003cb\u003e\u003cp align=\"center\"\u003eReact Component for virtual tour creation\u003c/p\u003e\u003c/b\u003e\n\n- It encapsulates \u003ca href=\"https://developers.google.com/vr/concepts/vrview\" target=\"_blank\"\u003eGoogle's Vrview Library\u003c/a\u003e\n- It is posible to define points (aka hotspots) to navigate between images/videos\n- It is posible to assign an arbitrary function to a hotspot click event\n- Using a smartphone and \u003ca href=\"https://vr.google.com/cardboard/\" target=\"_blank\"\u003eGoogle's Cardboard\u003c/a\u003e\n  or other specialized hardware it is posible to have a full and inmersive virtual reality expereince\n\n## Demo\n\n- \u003ca href=\"https://yagolopez.js.org/vrview-react/build/\" target=\"_blank\"\u003eDEMO full screen (for mobile)\u003c/a\u003e\n- \u003ca href=\"http://mobiletest.me/htc_one_emulator/?u=https://yagolopez.js.org/vrview-react/build/\"\n  target=\"_blank\"\u003eDEMO in simulator (for desktop)\u003c/a\u003e \u003cb\u003eWarning: \u003c/b\u003e Javascript in external iframes might have restrictions\n  for security reasons. Run the full scren demo to avoid restrictions.\n  - Note: the demo uses Fabric UI Framework from Microsoft\n\n## Requirements\n- Node/npm/yarn\n- A project created with Create-React-App for Typescript. If you don't want to use Typescript you must erase all\n  type information manually.\n\n## Installation\n\n- To install in a existing `Create-React-App` project, run `nmp install --save YagoLopez/vrview-react`\n- To copy and run this project:\n  - Clone or fork this repository\n  - Install dependencies: `npm install` inside your local directory project\n  - Run the application: `npm run start`\n\n## Application Programming Interface\n\n```reactjs\n\u003cVrview {...scene} /\u003e\n```\n\nVrview is a prure component. It receives scene data as props from a parent component and asign those props to its state which implements the following interface:\n\n```typescript\nexport interface IScene {\n  scene: {\n\n    // Scene id\n    id: number | string,\n\n    // Scene title\n    title?: string,\n\n    // Scene description\n    description?: string,\n\n    // URL pointing to a 360° video file or an adaptive streaming manifest file (.mpd or .m3u8).\n    video?: string,\n\n    // URL pointing to a 360° image file. Exactly one video or image is required.\n    // Images and videos must be in /public directory\n    image?: string,\n\n    // Iframe's width attribute.\n    width?: \tstring | number,\n\n    // Iframe's height attribute.\n    height?: string | number,\n\n    // URL to a preview image for a 360º scene (video/image).\n    preview?: string,\n\n    // Indicates whether the content has stereo format or not.\n    is_stereo?: boolean,\n\n    // Turns on/off debug canvas features (like showing the FPS meter).\n    is_debug?: boolean,\n\n    // Enables/disables the VR mode button.\n    is_vr_off?: boolean,\n\n    // Enables/disables the autopan introduction on desktop.\n    is_autopan_off?: boolean,\n\n    // When true, prevents roll and pitch. This is intended for stereo panoramas.\n    is_yaw_only?: boolean,\n\n    // The initial volume of the media; it ranges between 0 and 1; zero equals muted.\n    volume?: number,\n\n    // Enable/disable the loop in the video\n    loop?: boolean,\n\n    // Mutes/unmutes the sound of the video\n    muted?: boolean,\n\n    // Numeric angle in degrees of the initial heading for scene.\n    default_yaw?: number,\n\n    // By default, the camera points at the center of the image.\n    // When true, the fullscreen button contained inside the VR View iframe will\n    // be hidden. This parameter is useful if the user wants to use VR View's fullscreen\n    // workflow (via vrView.setFullscreen() callback) with an element outside the iframe.\n    hide_fullscreen_button?: boolean\n  },\n\n  // Array of clickable points on scene\n  hotspots?: Array\u003cIHotspot\u003e\n}\n```\n\nA scene can have zero or more hotspots of type `IHotspot`:\n\n```typescript\nexport interface IHotspot {\n\n  // Hotspot identifier. Used on click event\n  name: string;\n\n  // The latitude of center, specified in degrees, between -90 and 90, with 0 at the horizon.\n  pitch: number;\n\n  // The longitude of center, specified in degrees, between -180 and 180, with 0 at the image center.\n  yaw: number;\n\n  // The radius of the hotspot, specified in meters.\n  radius: number;\n\n  // The distance of the hotspot from camera, specified in meters.\n  distance: number;\n\n  // Destination scene for on click event\n  idNewScene?: number | string;\n\n  // Arbitrary function to run on hotspot click event. (Function call must be string to be valid JSON)\n  clickFn?: string;\n\n}\n```\n\n## Use\n\n- Static assets like images and videos must go in `public` directory\n- Copy `public/vrview` folder to your project `public` folder\n- Import `Vrview` component from `node_modules/vrview-react/src/vrview`\n- Define a scene in json format and pass it to `VrviewCmp` component as props. Each scene follows the interface `IScene`.\n  For example, for a simple scene:\n\n```javascript\nscene: IScene = {\n  scene: {width: '90%', height: 400, image: '../images/coral.jpg', is_stereo: true, is_debug: true}\n}\n```\n\n- To create a virtual tour with several scenes you can define an array of scenes. To navigate from one\n  scene to another define a hotspot and a relation with other scene using \"idNewScene\" as external key (like in a\n  relational database). In this demo it has been used the Repository Pattern and a `SceneCollection` Class that loads\n  and manages the scenes from a `scenes.json` file but this data could be loaded from an external API.\n\n```javascript\n[{\n  \"scene\":\n  {\n    \"id\": 1,\n    \"width\": \"100%\",\n    \"height\": 400,\n    \"image\": \"../images/coral.jpg\",\n    \"is_stereo\": true,\n    \"is_debug\": true,\n    \"title\": \"Title Scene 1\",\n    \"description\": \"Initial scene with three hotspots. One hotspot has a new scene associated, other has no new scene and the third executes a function\"\n  },\n  \"hotspots\": [\n    {\"name\": \"scene1-hotspot1\", \"pitch\": 0, \"yaw\": 0, \"radius\": 0.05, \"distance\": 2, \"idNewScene\": 2},\n    {\"name\": \"scene1-hotspot2\", \"pitch\": 0, \"yaw\": -35, \"radius\": 0.05, \"distance\": 2},\n    {\"name\": \"scene1-hotspot3\", \"pitch\": -20, \"yaw\": -25, \"radius\": 0.05, \"distance\": 2,\n      \"clickFn\": \"alert('Function executed');\"}\n  ]\n},\n {\n   \"scene\":\n   {\n     \"id\": 2,\n     \"image\": \"../images/landscape1.jpg\",\n     \"is_stereo\": false,\n     \"title\": \"Title Scene 2\",\n     \"description\": \"Scene 2 has two hotspots with respectives scenes associated\"\n   }\n }]\n```\n\n\n- Each time the user clicks a hotspot a new scene is loaded from `ScenesCollection` and passed from `App`\n  component to `VrviewCmp` as props and `VrviewCmp` set its state from the incoming props with the new scene data.\n\n- Hotspots are optional and you can also define an arbitrary function for a hotspot click event.\n  For example, in the following case instead of defining a `idNewScene` object just define the `clickFn` property:\n\n```javascript\n{\n  scene: {image: '../images/walrus.jpg', is_stereo: true},\n  hotspots: [\n    {name: 'hotspot5', pitch: -20, yaw: -25, radius: 0.05, distance: 2, clickFn: '() =\u003e alert(\"Function executed\")'}\n  ]\n}\n```\n\n## UML Demo Diagram\n\u003cp align=\"center\"\u003e\u003cimg src=\"uml/uml.jpg\" /\u003e\u003c/p\u003e\n\n# Disclaimer\nAt the moment it seems IE \u003c 11 and some IOS can experiment malfunction with three.js library. Feel free to open an issue\n\nLicense MIT\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#\"\u003eBack to top \u0026uarr;\u003c/a\u003e\u003c/p\u003e\n","funding_links":[],"categories":["Web-Based Frameworks"],"sub_categories":["Motion Controllers inside Unity!"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYagoLopez%2Fvrview-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FYagoLopez%2Fvrview-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYagoLopez%2Fvrview-react/lists"}