{"_id":"58f7a4c8cbd001190056cc1e","__v":0,"project":"578c4badbd223d2000cc1441","category":{"_id":"58f7a4c8cbd001190056cbfe","__v":0,"version":"58f7a4c8cbd001190056cbf8","project":"578c4badbd223d2000cc1441","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-08-01T23:04:12.838Z","from_sync":false,"order":5,"slug":"api-reference","title":"API Reference"},"parentDoc":null,"user":"576c22a3808cf02b00d37419","version":{"_id":"58f7a4c8cbd001190056cbf8","__v":1,"project":"578c4badbd223d2000cc1441","createdAt":"2017-04-19T17:56:24.172Z","releaseDate":"2017-04-19T17:56:24.172Z","categories":["58f7a4c8cbd001190056cbf9","58f7a4c8cbd001190056cbfa","58f7a4c8cbd001190056cbfb","58f7a4c8cbd001190056cbfc","58f7a4c8cbd001190056cbfd","58f7a4c8cbd001190056cbfe"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.1.0","version":"1.1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-03-18T01:10:45.994Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":22,"body":"[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Only Available on Android (Cardboard for Android, GearVR and Daydream)\",\n  \"body\": \"This component will be available on Cardboard for iOS, but will simply act like a ViroSound\"\n}\n[/block]\nA component that represents a sound in 3D space. Must be a single-channel sound (mono) and can be placed within a ViroNode or ViroAnimatedComponent which changes its position relative to the user. Refer to [Sound](doc:audio) under Develop for more information.\n\n######Example use:\n```\n<ViroSpatialSound\n    source={require(\"./sound/mysound.mp3\")}\n    position={[0, 0, -3]}\n    onLoadEnd={this._onLoadEnd} />\n```\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-0\": \"PropKey\",\n    \"h-1\": \"PropType\",\n    \"0-1\": \"**PropTypes.oneOfType( [PropTypes.shape( {uri:PropTypes.string} ), PropTypes.number])**\\n\\nThe source of a spatial sound. Must be a single-channel audio file.\",\n    \"0-0\": \"**source**\"\n  },\n  \"cols\": 2,\n  \"rows\": 1\n}\n[/block]\n##Optional Props\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"**loop**\",\n    \"3-0\": \"**muted**\",\n    \"h-0\": \"PropKey\",\n    \"h-1\": \"PropType\",\n    \"0-1\": \"**PropTypes.bool**\\n\\nSet to true to loop the spatial sound. This is set to false by default.\",\n    \"3-1\": \"**PropTypes.bool**\\n\\nSet to true to mute the spatial sound. This is set to false by default.\",\n    \"5-0\": \"**onFinish**\",\n    \"5-1\": \"**React.PropTypes.func**\\n\\nCallback that is called when the spatial sound is finished playing. This function isn't called at the end of a spatial sound if looping is enabled.\",\n    \"6-0\": \"**paused**\",\n    \"6-1\": \"**PropTypes.bool**\\n\\nSet to true to pause the spatial sound. This is set to false by default.\",\n    \"8-0\": \"**volume**\",\n    \"8-1\": \"**PropTypes.number**\\n\\nA number represented volume from 0 to 1. Max volume is equal to 1. Min volume is equal to 0. This is set to 1 by default.\",\n    \"7-0\": \"**rolloffModel**\",\n    \"7-1\": \"**PropTypes.string**\\n\\nThe rolloff model which determines how the sound volume will fall off between minDistance and maxDistance. Accepts the following values:\\n\\n*None\\n*Linear\\n*Logarithmic\",\n    \"1-0\": \"**maxDistance**\",\n    \"2-0\": \"**minDistance**\",\n    \"1-1\": \"**PropTypes.number**\\n\\nA distance after which the audio can not be heard.\",\n    \"2-1\": \"**PropTypes.number**\\n\\nA distance after which the audio will begin to attenuate until maxDistance where the sound is completely gone.\",\n    \"4-0\": \"**onError**\",\n    \"4-1\": \"**React.PropTypes.func**\\n\\nCallback invoked when the 360 Image fails to load. The error message is contained in event.nativeEvent.error\",\n    \"9-0\": \"**position**\",\n    \"9-1\": \"**PropTypes.arrayOf(PropTypes.number)**\\n\\nCartesian position of the sound in 3D world space, specified as [x, y, z].\"\n  },\n  \"cols\": 2,\n  \"rows\": 10\n}\n[/block]","excerpt":"","slug":"virospatialsound","type":"basic","title":"ViroSpatialSound"}
[block:callout] { "type": "danger", "title": "Only Available on Android (Cardboard for Android, GearVR and Daydream)", "body": "This component will be available on Cardboard for iOS, but will simply act like a ViroSound" } [/block] A component that represents a sound in 3D space. Must be a single-channel sound (mono) and can be placed within a ViroNode or ViroAnimatedComponent which changes its position relative to the user. Refer to [Sound](doc:audio) under Develop for more information. ######Example use: ``` <ViroSpatialSound source={require("./sound/mysound.mp3")} position={[0, 0, -3]} onLoadEnd={this._onLoadEnd} /> ``` [block:api-header] { "type": "basic", "title": "Props" } [/block] ##Required props [block:parameters] { "data": { "h-0": "PropKey", "h-1": "PropType", "0-1": "**PropTypes.oneOfType( [PropTypes.shape( {uri:PropTypes.string} ), PropTypes.number])**\n\nThe source of a spatial sound. Must be a single-channel audio file.", "0-0": "**source**" }, "cols": 2, "rows": 1 } [/block] ##Optional Props [block:parameters] { "data": { "0-0": "**loop**", "3-0": "**muted**", "h-0": "PropKey", "h-1": "PropType", "0-1": "**PropTypes.bool**\n\nSet to true to loop the spatial sound. This is set to false by default.", "3-1": "**PropTypes.bool**\n\nSet to true to mute the spatial sound. This is set to false by default.", "5-0": "**onFinish**", "5-1": "**React.PropTypes.func**\n\nCallback that is called when the spatial sound is finished playing. This function isn't called at the end of a spatial sound if looping is enabled.", "6-0": "**paused**", "6-1": "**PropTypes.bool**\n\nSet to true to pause the spatial sound. This is set to false by default.", "8-0": "**volume**", "8-1": "**PropTypes.number**\n\nA number represented volume from 0 to 1. Max volume is equal to 1. Min volume is equal to 0. This is set to 1 by default.", "7-0": "**rolloffModel**", "7-1": "**PropTypes.string**\n\nThe rolloff model which determines how the sound volume will fall off between minDistance and maxDistance. Accepts the following values:\n\n*None\n*Linear\n*Logarithmic", "1-0": "**maxDistance**", "2-0": "**minDistance**", "1-1": "**PropTypes.number**\n\nA distance after which the audio can not be heard.", "2-1": "**PropTypes.number**\n\nA distance after which the audio will begin to attenuate until maxDistance where the sound is completely gone.", "4-0": "**onError**", "4-1": "**React.PropTypes.func**\n\nCallback invoked when the 360 Image fails to load. The error message is contained in event.nativeEvent.error", "9-0": "**position**", "9-1": "**PropTypes.arrayOf(PropTypes.number)**\n\nCartesian position of the sound in 3D world space, specified as [x, y, z]." }, "cols": 2, "rows": 10 } [/block]