Memulai
Copy a setup prompt with the install steps and the full markdown guide for this plugin.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-ricoh360-camera-plugin`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/id/docs/plugins/ricoh360-camera/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Instalasi
Section titled “Instalasi”npm install @capgo/capacitor-ricoh360-cameranpx cap syncyarn add @capgo/capacitor-ricoh360-cameranpx cap syncpnpm add @capgo/capacitor-ricoh360-cameranpx cap syncbun add @capgo/capacitor-ricoh360-cameranpx cap syncKonfigurasi Platform
Section titled “Konfigurasi Platform”Tambahkan izin kamera dan photo library ke Info.plist Anda:
<key>NSCameraUsageDescription</key><string>This app needs access to the camera to capture 360° photos and videos</string><key>NSPhotoLibraryAddUsageDescription</key><string>This app needs access to save 360° photos and videos to your library</string>Android
Section titled “Android”Tambahkan izin yang diperlukan ke AndroidManifest.xml Anda:
<uses-permission android:name="android.permission.CAMERA" /><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /><uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /><uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />Perangkat yang Didukung
Section titled “Perangkat yang Didukung”Plugin ini mendukung kamera seri Ricoh Theta:
- Ricoh Theta V
- Ricoh Theta Z1
- Ricoh Theta SC2
- Ricoh Theta X
Contoh Penggunaan
Section titled “Contoh Penggunaan”import { Ricoh360Camera } from '@capgo/capacitor-ricoh360-camera';
// Initialize camera connectionawait Ricoh360Camera.initialize();
// Connect to Ricoh Theta camera via WiFiawait Ricoh360Camera.connect({ ssid: 'THETAYL12345678', password: '12345678'});
// Start live previewawait Ricoh360Camera.startPreview({ container: 'preview-container' // ID of HTML element});
// Capture a 360° photoconst result = await Ricoh360Camera.capturePhoto();console.log('Photo saved:', result.filePath);
// Start recording 360° videoawait Ricoh360Camera.startRecording();
// Stop recording after some timesetTimeout(async () => { const video = await Ricoh360Camera.stopRecording(); console.log('Video saved:', video.filePath);}, 10000);
// Stop previewawait Ricoh360Camera.stopPreview();
// Disconnect from cameraawait Ricoh360Camera.disconnect();Referensi API
Section titled “Referensi API”initialize()
Section titled “initialize()”initialize() => Promise<void>Inisialisasi plugin kamera.
connect(options)
Section titled “connect(options)”connect(options: ConnectOptions) => Promise<void>Hubungkan ke kamera Ricoh Theta melalui WiFi.
| Param | Type |
|---|---|
options | ConnectOptions |
disconnect()
Section titled “disconnect()”disconnect() => Promise<void>Putuskan koneksi dari kamera.
startPreview(options)
Section titled “startPreview(options)”startPreview(options: PreviewOptions) => Promise<void>Mulai streaming preview 360° langsung.
| Param | Type |
|---|---|
options | PreviewOptions |
stopPreview()
Section titled “stopPreview()”stopPreview() => Promise<void>Hentikan streaming preview langsung.
capturePhoto(options?)
Section titled “capturePhoto(options?)”capturePhoto(options?: CaptureOptions) => Promise<CaptureResult>Tangkap foto 360°.
| Param | Type |
|---|---|
options | CaptureOptions (optional) |
Returns: Promise<CaptureResult>
startRecording(options?)
Section titled “startRecording(options?)”startRecording(options?: RecordingOptions) => Promise<void>Mulai merekam video 360°.
| Param | Type |
|---|---|
options | RecordingOptions (optional) |
stopRecording()
Section titled “stopRecording()”stopRecording() => Promise<CaptureResult>Hentikan perekaman video.
Returns: Promise<CaptureResult>
getCameraInfo()
Section titled “getCameraInfo()”getCameraInfo() => Promise<CameraInfo>Dapatkan informasi dan kemampuan kamera.
Returns: Promise<CameraInfo>
setExposure(options)
Section titled “setExposure(options)”setExposure(options: ExposureOptions) => Promise<void>Atur pengaturan exposure kamera.
| Param | Type |
|---|---|
options | ExposureOptions |
setWhiteBalance(options)
Section titled “setWhiteBalance(options)”setWhiteBalance(options: WhiteBalanceOptions) => Promise<void>Atur mode white balance.
| Param | Type |
|---|---|
options | WhiteBalanceOptions |
Interface
Section titled “Interface”ConnectOptions
Section titled “ConnectOptions”| Prop | Type | Description |
|---|---|---|
ssid | string | WiFi SSID dari kamera Ricoh |
password | string | Password WiFi dari kamera |
PreviewOptions
Section titled “PreviewOptions”| Prop | Type | Description |
|---|---|---|
container | string | ID elemen HTML untuk container preview |
CaptureOptions
Section titled “CaptureOptions”| Prop | Type | Description |
|---|---|---|
quality | number | Kualitas gambar (1-100) (opsional) |
saveToGallery | boolean | Simpan ke galeri perangkat (opsional) |
RecordingOptions
Section titled “RecordingOptions”| Prop | Type | Description |
|---|---|---|
maxDuration | number | Durasi rekaman maksimum dalam detik (opsional) |
quality | string | Kualitas video: ‘high’ | ‘medium’ | ‘low’ (opsional) |
CaptureResult
Section titled “CaptureResult”| Prop | Type | Description |
|---|---|---|
filePath | string | Path ke file yang ditangkap |
fileUrl | string | URL untuk mengakses file |
CameraInfo
Section titled “CameraInfo”| Prop | Type | Description |
|---|---|---|
model | string | Nama model kamera |
serialNumber | string | Nomor seri kamera |
firmwareVersion | string | Versi firmware |
batteryLevel | number | Level baterai (0-100) |
ExposureOptions
Section titled “ExposureOptions”| Prop | Type | Description |
|---|---|---|
mode | string | Mode exposure: ‘auto’ | ‘manual’ | ‘iso’ |
iso | number | Nilai ISO (100, 200, 400, dll.) (opsional) |
shutter | number | Kecepatan shutter (opsional) |
WhiteBalanceOptions
Section titled “WhiteBalanceOptions”| Prop | Type | Description |
|---|---|---|
mode | string | White balance: ‘auto’ | ‘daylight’ | ‘cloudy’ | ‘tungsten’ | ‘fluorescent’ |
Contoh Lengkap
Section titled “Contoh Lengkap”import { Ricoh360Camera } from '@capgo/capacitor-ricoh360-camera';
class Camera360Controller { async setup() { try { // Initialize await Ricoh360Camera.initialize();
// Connect to camera await Ricoh360Camera.connect({ ssid: 'THETAYL12345678', password: '12345678' });
// Get camera info const info = await Ricoh360Camera.getCameraInfo(); console.log('Connected to:', info.model); console.log('Battery level:', info.batteryLevel + '%');
// Configure exposure await Ricoh360Camera.setExposure({ mode: 'auto' });
// Configure white balance await Ricoh360Camera.setWhiteBalance({ mode: 'auto' });
// Start preview await Ricoh360Camera.startPreview({ container: 'camera-preview' });
} catch (error) { console.error('Failed to setup camera:', error); } }
async takePhoto() { try { const result = await Ricoh360Camera.capturePhoto({ quality: 95, saveToGallery: true }); console.log('Photo captured:', result.filePath); return result; } catch (error) { console.error('Failed to capture photo:', error); } }
async recordVideo(durationSeconds: number) { try { // Start recording await Ricoh360Camera.startRecording({ maxDuration: durationSeconds, quality: 'high' });
console.log('Recording started...');
// Stop after duration setTimeout(async () => { const result = await Ricoh360Camera.stopRecording(); console.log('Video saved:', result.filePath); }, durationSeconds * 1000);
} catch (error) { console.error('Failed to record video:', error); } }
async cleanup() { try { await Ricoh360Camera.stopPreview(); await Ricoh360Camera.disconnect(); console.log('Camera disconnected'); } catch (error) { console.error('Failed to cleanup:', error); } }}
// Usageconst camera = new Camera360Controller();await camera.setup();await camera.takePhoto();await camera.recordVideo(10); // 10 secondsawait camera.cleanup();Praktik Terbaik
Section titled “Praktik Terbaik”- Selalu inisialisasi plugin sebelum menghubungkan ke kamera
- Pastikan perangkat terhubung ke jaringan WiFi kamera
- Tangani error dengan baik, terutama kegagalan koneksi
- Hentikan preview dan putuskan koneksi saat selesai untuk menghemat baterai
- Periksa level baterai kamera sebelum sesi rekaman panjang
- Test pada hardware Ricoh Theta yang sebenarnya
- Gunakan kualitas video yang sesuai berdasarkan batasan penyimpanan
Troubleshooting
Section titled “Troubleshooting”Masalah Koneksi
Section titled “Masalah Koneksi”- Verifikasi bahwa kamera dalam keadaan menyala
- Periksa SSID WiFi dan password sudah benar
- Pastikan tidak ada aplikasi lain yang terhubung ke kamera
- Reset pengaturan WiFi kamera jika koneksi gagal
Preview Tidak Muncul
Section titled “Preview Tidak Muncul”- Verifikasi elemen container HTML ada
- Periksa izin kamera telah diberikan
- Pastikan preview dimulai setelah koneksi berhasil
Kegagalan Capture
Section titled “Kegagalan Capture”- Periksa ruang penyimpanan yang tersedia
- Verifikasi level baterai kamera cukup
- Pastikan kamera tidak dalam mode sleep