Install
- Open the CarHub dashboard and go to API, MCP & SDKs → SDKs.
- Find Player SDK under Your SDKs and click Set up SDK.
- Choose Create project token and follow the guided npm setup. An organization owner or admin can create the token.
ResizeObserver, pointer events and AbortController.
Display a 360° spin
Add a container and provideframes as an array of image URLs in rotation order.
The Player fills the container width and sets its height from the media’s aspect ratio.
player.destroy() when you remove the viewer. Try the same setup in the
interactive Player demo.
Use frames from a CarHub 360° job
Submitrender.360 with top-level public_output: true to keep generated frames available for a published listing. Endpoint access is sufficient to request public outputs. See public output files for quota and access requirements.
Retrieve the completed job on your server with GET /v1/jobs/{id}. Extract the image URLs in rotation order and pass the array to spinFrames:
image.expires_at: null and need no browser API key. Unpublishing the job revokes the public URLs for all its frames. Without public_output: true, download each image before its signed URL expires and serve lasting listings from your own storage. Keep your CarHub API key on your server.
Load report data
Pass Player-format JSON for inspection photos, panoramas, and damage markers. A CarHub inference job uses a different format. The CarHub Jobs API does not provide Player reports.GET /reports/{token} and accept the credential as a bearer token.
baseUrl to https://api.trycarhub.com/, but that API does not serve this report route. report takes precedence over token. When using a token, fetchReport takes precedence over the built-in loader. The current player package does not acquire SDK licenses automatically. See SDK licenses for the separate license API.
If you supply a report jwt, the loader sends it as X-JWT and retries once without it on 401. Report JWTs and SDK license proofs serve separate purposes.
Configure the player
Pass configuration when you create the player. The defaults below apply unless you override them.All display options and defaults
All display options and defaults
The available
TabId values are 360, exterior, interior, interior360, others and damages.Override options with URL query parameters
Override options with URL query parameters
Query parameters are off by default. Enable them when you want the SDK to follow the iframe embed contract. Query values then take precedence over supplied options, which take precedence over defaults.For example,
?tabview=360&hotspot=false&excludeTab=interior,damages overrides the corresponding options.Control the player
The instance exposes methods for navigation and playback.showSlide() uses one global slide list, ordered exterior, interior, interior 360°, others and damages. The player automatically switches to the matching view.
Read the active state with player.currentView, player.tabs, player.frame and player.currentReport.
Subscribe to events
Attach listeners immediately after creating the player. Initial events are emitted in a microtask, so the listener receivesready.
Event payloads and custom sharing
Event payloads and custom sharing
on, off and once are chainable. framechange can fire about 30 times a second during autoplay, so sample it before rendering UI from it.To replace sharing, prevent the default behavior:Use a framework binding
The core player has bindings for React, Vue, and Angular. The React example below uses the same orderedframes array.
Use the custom element
Use the custom element
If you already have a Player report, you can use the custom element. Import it from your installed package and set the report before adding it to the page.Its attributes mirror player options in kebab case. A bare boolean attribute enables the option. Set
attribute="false" to disable it.Theme and translate labels
Set CSS custom properties on the host element. They cross the Shadow DOM boundary.data-theme="light" or data-theme="dark" on the host element to fix the theme. Without it, the player follows the user’s color-scheme preference.
Translate damage and vehicle-part labels
Translate damage and vehicle-part labels
The player converts damage and vehicle-part keys to readable labels by default. Use the optional i18n export for its five-language dictionary:
Add interior panoramas
Add interior panoramas
RICOH THETA equirectangular images use Photo Sphere Viewer. Install its optional peer dependencies to render them as interactive panoramas:Without these packages, a panorama falls back to a flat image.
Migrate an existing report or iframe integration
Migrate an existing report or iframe integration
To replace an iframe, create a container and Player instance. Enable
readQueryParams to preserve URL-driven configuration.