File
Description of the files
field¶
interface FileState {
currentFile: File | undefined
userProfile: string | undefined
currentFileUrl: string | undefined
fileToSwitchDetails: {
fileId: string
configurationId: string
keepConfiguration: boolean
}
isStreaming: boolean
isLoadingFile: boolean
}
currentFile
¶
Updated by: UI
Determine the file to be loaded by the Player.
In order to open a file correctly the UI must set the following fields:
Data model¶
interface File {
id: string
name: string
path: string
type: 'file' | 'dir'
shareToken: string | undefined
img: string | undefined
updateCounter: number
offlineUpdateCounter: number | undefined
isFavorited: boolean
parent: string
state: string
created: number
updated: number
revision size: number
user: string
owner: string
ownerName: string
sceneTreeNames: string[]
sceneTreeRoots: string[]
privateShares?: string[]
favoritedBy: string[]
}
Examples¶
Open a file¶
{
"files":{
...
"currentFile":{
"allowLivePublicMeetings":false,
"bucket":"smartshape-bucket",
"created":1643706381624,
"error":"",
"favoritedBy":[],
"id":"61f8f80d5d3c8d000b021eaf",
"img":"https://smartshape.io.test/file/download/private/middlewareTestFile.fbx/thumbnail.png",
"isFavorited":false,
"isLink":false,
"key":"2022-02-01-61f8f80d5d3c8d000b021eaf/61f8f80d5d3c8d000b021eaf.fbx",
"name":"middlewareTestFile.fbx",
"owner":"61e6d38393821b78651614ff",
"parent":"/",
"path":"/middlewareTestFile.fbx",
"privateShareFileId":"61f8f80d5d3c8d000b021eaf",
"revisionDate":1643706381624,
"roles":[],
"sceneTreeNames":["default"],
"sceneTreeRoots":["29054778-43b6-4c49-5afa-2f342d588274"],
"shareToken":"",
"size":47788,
"state":"converted",
"type":"file",
"updateCounter":59,
"updated":1643716821621,
"user":"61e6d38393821b78651614ff"
}
...
}
}
Close a file¶
userProfile
¶
Updated by: UI
Defines the relationship of the user with the file currently opened (defined in /files/currentFile
):
owner
: The file currently opened is owned by the user.contact
: The file currently opened has been shared with the user.
Data model¶
Examples¶
Set the current file as "owned" by the user¶
currentFileUrl
¶
Updated by: UI
Set the URL for the Player to download the file and to display it.
Data model¶
Examples¶
Specify the URL of the current file¶
{
"files":{
...
"currentFileUrl": "https://smartshape.io.test/file/download/private/cube.fbx/cube.fbx.scene"
...
}
}
fileToSwitchDetails
¶
Updated by: Player
Set by the Player when the camera enters a Trigger. The field describes the file to open.
Data model¶
Operations done by the Player¶
When the camera enters a Trigger, the Player sets the field to describe the file to open.
{
"files":{
...
"fileToSwitchDetails":{
"fileId":"61e6d3a9333a62000b3706cc",
"configurationId":"61f8f80d5d3c8d000b021eb1",
"keepConfiguration":false
}
...
}
}
isStreaming
¶
Updated by: Player
Inform the UI that the Player is streaming data.
Data model¶
Operations done by the Player¶
The Player sets the field to a boolean depending on its state:
isLoadingFile
¶
Updated by: Player
Inform the UI that the Player is loading a file.
Data model¶
Operations done by the Player¶
The Player sets the field to a boolean depending on its state: