@mymosdk/avatar 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,7 +50,9 @@ yarn add @mymosdk/avatar three
|
|
|
50
50
|
import { Avatar } from "@mymosdk/avatar"
|
|
51
51
|
|
|
52
52
|
const avatar = new Avatar({
|
|
53
|
-
|
|
53
|
+
// Pass any GLB or VRM URL hosted on a CORS-enabled server.
|
|
54
|
+
// See "Model hosting" below for details.
|
|
55
|
+
model: "https://your-cdn.example.com/my-avatar.vrm",
|
|
54
56
|
position: "bottom-right",
|
|
55
57
|
size: 200,
|
|
56
58
|
theme: "dark",
|
|
@@ -62,6 +64,31 @@ The avatar mounts itself to `document.body` as a fixed floating widget immediate
|
|
|
62
64
|
|
|
63
65
|
---
|
|
64
66
|
|
|
67
|
+
## Model hosting
|
|
68
|
+
|
|
69
|
+
The SDK loads models via the browser's `fetch` / XHR APIs, so the server that hosts your `.vrm` or `.glb` file **must send CORS headers** (`Access-Control-Allow-Origin: *`).
|
|
70
|
+
|
|
71
|
+
| Hosting option | CORS | Notes |
|
|
72
|
+
|---|---|---|
|
|
73
|
+
| Your own server / CDN | ✅ configure it | Full control |
|
|
74
|
+
| Cloudflare R2 (free tier) | ✅ built-in | Recommended for production |
|
|
75
|
+
| GitHub Pages | ✅ built-in | Free, served from your repo |
|
|
76
|
+
| Local `public/` folder | ✅ same-origin | Use during development |
|
|
77
|
+
| **GitHub Releases** | ❌ not supported | Redirects to a domain that blocks browser CORS |
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
// ✅ Works — CORS-enabled CDN
|
|
81
|
+
avatar.load("https://your-cdn.example.com/my-avatar.vrm")
|
|
82
|
+
|
|
83
|
+
// ✅ Works — local file served by Vite / webpack dev server
|
|
84
|
+
avatar.load("/models/my-avatar.vrm")
|
|
85
|
+
|
|
86
|
+
// ❌ Will fail in the browser — GitHub Releases don't support CORS
|
|
87
|
+
avatar.load("https://github.com/user/repo/releases/download/tag/file.vrm")
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
65
92
|
## API
|
|
66
93
|
|
|
67
94
|
### Constructor options
|