{"_id":"5a06037134873d0010b3921a","category":{"_id":"5a06037134873d0010b39204","version":"5a06037134873d0010b391fe","project":"578c4badbd223d2000cc1441","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-08-01T23:04:12.838Z","from_sync":false,"order":5,"slug":"api-reference","title":"API Reference"},"project":"578c4badbd223d2000cc1441","user":"576c22a3808cf02b00d37419","parentDoc":null,"version":{"_id":"5a06037134873d0010b391fe","project":"578c4badbd223d2000cc1441","__v":1,"createdAt":"2017-11-10T19:52:17.163Z","releaseDate":"2017-11-10T19:52:17.163Z","categories":["5a06037134873d0010b391ff","5a06037134873d0010b39200","5a06037134873d0010b39201","5a06037134873d0010b39202","5a06037134873d0010b39203","5a06037134873d0010b39204"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.1.0","version":"2.1.0"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-09-16T17:39:19.099Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":9,"body":"The `ViroARSceneNavigator` is the entry point for AR applications with Viro. For more information about developing in AR, see our Develop page for [Augmented Reality (AR)](doc:augmented-reality-ar).\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Props\"\n}\n[/block]\n##Required Props\n[block:parameters]\n{\n  \"data\": {\n    \"h-1\": \"PropType\",\n    \"h-0\": \"PropKey\",\n    \"0-0\": \"**apiKey**\",\n    \"0-1\": \"**PropTypes.string.isRequired
**
\\n\\nRequired API Key\",\n    \"1-0\": \"**initialScene**\",\n    \"1-1\": \"**PropTypes.shape( {scene: PropTypes.func.isRequired
} ),**
\\n\\nThe initial AR scene to display for your application on application start.\\n\\nNote: ViroARSceneNavigator only accepts [ViroARScene](doc:viroarscene)\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"Push the given scene onto scene stack, displaying the scene to the user.\\n\\n|Parameters    | Description |        \\n| ------------- |:------------- |\\n|scene    | Scene that will be pushed onto the stack and displayed to the user |\",\n    \"h-0\": \"push(scene: ViroARScene)\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"pop()\",\n    \"0-0\": \"Pop the top most scene of the stack, effectively going back to the previous scene.\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"pop(n: number)\",\n    \"0-0\": \"Go back n scenes at once. If n is equal to 1 this is equivalent to calling pop().\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"jump(scene: ViroARScene)\",\n    \"0-0\": \"Move to the given scene in the stack, removing it from its current position in the stack and placing it on top, thereby displaying it to the user. If the scene is not already on the stack, this method pushes the scene to the top of the stack, displaying it to the user. This is best used in applications where the user jumps between a set of scenes frequently.\\n\\n|Parameters    | Description |        \\n| ------------- |:------------- |\\n|scene    | Scene that will be moved or pushed to the top of the stack and displayed to the user |\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"Replace the currently displayed scene (the scene at the top of the stack) with the given scene, displaying it to the user. This leaves the remainder of the stack unchanged.\\n\\n|Parameters    | Description |        \\n| ------------- |:------------- |\\n|scene    | Scene that will replace the scene at the top of stack and be displayed to the user |\",\n    \"h-0\": \"replace(scene: ViroARScene)\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"startVideoRecording(fileName: string, saveToCameraRoll: bool, onError: func)\",\n    \"0-0\": \"Starts a recording of the ViroARSceneNavigator capturing only Viro-rendered components and external audio (microphone and camera permissions required).\\n\\n|Parameters    | Description |        \\n| ------------- |:------------- |\\n|fileName    | name of the file saved to app's temporary files. If the name matches an existing file at the location, it will be overridden. A file extension will automatically be added. |\\n|saveToCameraRoll | Whether or not the file should also be saved to the user's Photos at the end of recording. (Requires photo/video saving permissions) |\\n|onError | a function invoked w/ an errorCode if recording encounters an issue. Possible error codes [here](doc:viroconstants#section-video-recording-screenshot-errors).|\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"async stopVideoRecording()\",\n    \"0-0\": \"[Async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) function called to stop video recording.\\n\\n| Return Values | Description |\\n| ------------- |:------------- |\\n| success |  true/false if stopping was successful|\\n| url | path to the file in the application's temporary files. |\\n|errorCode | a number representing an error while stopping recording. Possible error codes [here](doc:viroconstants#section-video-recording-screenshot-errors).|\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"async takeScreenshot(fileName: string, saveToCameraRoll: bool)\",\n    \"0-0\": \"[Async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) function called to take a screenshot of the ViroARSceneNavigator capturing only Viro-rendered components.\\n\\n|Parameters    | Description |        \\n| ------------- |:------------- |\\n|fileName    | name of the file saved to app's temporary files. If the name matches an existing file at the location, it will be overridden. A file extension will automatically be added. |\\n|saveToCameraRoll | Whether or not the file should also be saved to the user's Photos at the end of recording. (Requires photo/video saving permissions) |\\n\\n| Return Values | Description |\\n| ------------- |:------------- |\\n| success |  true/false if stopping was successful|\\n| url | path to the file in the application's temporary files. |\\n|errorCode | a number representing an error while taking/saving the screenshot. Possible error codes [here](doc:viroconstants#section-video-recording-screenshot-errors).|\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]","excerpt":"","slug":"viroarscenenavigator","type":"basic","title":"ViroARSceneNavigator"}

ViroARSceneNavigator


The `ViroARSceneNavigator` is the entry point for AR applications with Viro. For more information about developing in AR, see our Develop page for [Augmented Reality (AR)](doc:augmented-reality-ar). [block:api-header] { "type": "basic", "title": "Props" } [/block] ##Required Props [block:parameters] { "data": { "h-1": "PropType", "h-0": "PropKey", "0-0": "**apiKey**", "0-1": "**PropTypes.string.isRequired
**
\n\nRequired API Key", "1-0": "**initialScene**", "1-1": "**PropTypes.shape( {scene: PropTypes.func.isRequired
} ),**
\n\nThe initial AR scene to display for your application on application start.\n\nNote: ViroARSceneNavigator only accepts [ViroARScene](doc:viroarscene)" }, "cols": 2, "rows": 2 } [/block] [block:api-header] { "type": "basic", "title": "Methods" } [/block] [block:parameters] { "data": { "0-0": "Push the given scene onto scene stack, displaying the scene to the user.\n\n|Parameters | Description | \n| ------------- |:------------- |\n|scene | Scene that will be pushed onto the stack and displayed to the user |", "h-0": "push(scene: ViroARScene)" }, "cols": 1, "rows": 1 } [/block] [block:parameters] { "data": { "h-0": "pop()", "0-0": "Pop the top most scene of the stack, effectively going back to the previous scene." }, "cols": 1, "rows": 1 } [/block] [block:parameters] { "data": { "h-0": "pop(n: number)", "0-0": "Go back n scenes at once. If n is equal to 1 this is equivalent to calling pop()." }, "cols": 1, "rows": 1 } [/block] [block:parameters] { "data": { "h-0": "jump(scene: ViroARScene)", "0-0": "Move to the given scene in the stack, removing it from its current position in the stack and placing it on top, thereby displaying it to the user. If the scene is not already on the stack, this method pushes the scene to the top of the stack, displaying it to the user. This is best used in applications where the user jumps between a set of scenes frequently.\n\n|Parameters | Description | \n| ------------- |:------------- |\n|scene | Scene that will be moved or pushed to the top of the stack and displayed to the user |" }, "cols": 1, "rows": 1 } [/block] [block:parameters] { "data": { "0-0": "Replace the currently displayed scene (the scene at the top of the stack) with the given scene, displaying it to the user. This leaves the remainder of the stack unchanged.\n\n|Parameters | Description | \n| ------------- |:------------- |\n|scene | Scene that will replace the scene at the top of stack and be displayed to the user |", "h-0": "replace(scene: ViroARScene)" }, "cols": 1, "rows": 1 } [/block] [block:parameters] { "data": { "h-0": "startVideoRecording(fileName: string, saveToCameraRoll: bool, onError: func)", "0-0": "Starts a recording of the ViroARSceneNavigator capturing only Viro-rendered components and external audio (microphone and camera permissions required).\n\n|Parameters | Description | \n| ------------- |:------------- |\n|fileName | name of the file saved to app's temporary files. If the name matches an existing file at the location, it will be overridden. A file extension will automatically be added. |\n|saveToCameraRoll | Whether or not the file should also be saved to the user's Photos at the end of recording. (Requires photo/video saving permissions) |\n|onError | a function invoked w/ an errorCode if recording encounters an issue. Possible error codes [here](doc:viroconstants#section-video-recording-screenshot-errors).|" }, "cols": 1, "rows": 1 } [/block] [block:parameters] { "data": { "h-0": "async stopVideoRecording()", "0-0": "[Async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) function called to stop video recording.\n\n| Return Values | Description |\n| ------------- |:------------- |\n| success | true/false if stopping was successful|\n| url | path to the file in the application's temporary files. |\n|errorCode | a number representing an error while stopping recording. Possible error codes [here](doc:viroconstants#section-video-recording-screenshot-errors).|" }, "cols": 1, "rows": 1 } [/block] [block:parameters] { "data": { "h-0": "async takeScreenshot(fileName: string, saveToCameraRoll: bool)", "0-0": "[Async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) function called to take a screenshot of the ViroARSceneNavigator capturing only Viro-rendered components.\n\n|Parameters | Description | \n| ------------- |:------------- |\n|fileName | name of the file saved to app's temporary files. If the name matches an existing file at the location, it will be overridden. A file extension will automatically be added. |\n|saveToCameraRoll | Whether or not the file should also be saved to the user's Photos at the end of recording. (Requires photo/video saving permissions) |\n\n| Return Values | Description |\n| ------------- |:------------- |\n| success | true/false if stopping was successful|\n| url | path to the file in the application's temporary files. |\n|errorCode | a number representing an error while taking/saving the screenshot. Possible error codes [here](doc:viroconstants#section-video-recording-screenshot-errors).|" }, "cols": 1, "rows": 1 } [/block]