Commencer
Installation
Section titled “Installation”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 syncPlatform Configuration
Section titled “Platform Configuration”Add camera and photo library permissions to your Info.plist:
<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”Add required permissions to your AndroidManifest.xml:
<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" />Supported Appareils
Section titled “Supported Appareils”This plugin supports Ricoh Theta series cameras:
- Ricoh Theta V
- Ricoh Theta Z1
- Ricoh Theta SC2
- Ricoh Theta X
Utilisation Exemple
Section titled “Utilisation Exemple”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();API Référence
Section titled “API Référence”Initialiser()
Section titled “Initialiser()”initialize() => Promise<void>Initialiser the camera plugin.
connect(Options)
Section titled “connect(Options)”connect(options: ConnectOptions) => Promise<void>Connect to a Ricoh Theta camera via WiFi.
| Param | Type |
|---|---|
options | ConnectOptions |
disconnect()
Section titled “disconnect()”disconnect() => Promise<void>Disconnect from the camera.
startPreview(Options)
Section titled “startPreview(Options)”startPreview(options: PreviewOptions) => Promise<void>Démarrer live 360° preview stream.
| Param | Type |
|---|---|
options | PreviewOptions |
stopPreview()
Section titled “stopPreview()”stopPreview() => Promise<void>Arrêter the live preview stream.
capturePhoto(Options?)
Section titled “capturePhoto(Options?)”capturePhoto(options?: CaptureOptions) => Promise<CaptureResult>Capture a 360° photo.
| Param | Type |
|---|---|
options | CaptureOptions (optional) |
Returns: Promise<CaptureResult>
startRecording(Options?)
Section titled “startRecording(Options?)”startRecording(options?: RecordingOptions) => Promise<void>Démarrer recording 360° video.
| Param | Type |
|---|---|
options | RecordingOptions (optional) |
stopRecording()
Section titled “stopRecording()”stopRecording() => Promise<CaptureResult>Arrêter video recording.
Returns: Promise<CaptureResult>
getCameraInfo()
Section titled “getCameraInfo()”getCameraInfo() => Promise<CameraInfo>Get camera Information and capabilities.
Returns: Promise<CameraInfo>
setExposure(Options)
Section titled “setExposure(Options)”setExposure(options: ExposureOptions) => Promise<void>Set camera exposure Paramètres.
| Param | Type |
|---|---|
options | ExposureOptions |
setWhiteBalance(Options)
Section titled “setWhiteBalance(Options)”setWhiteBalance(options: WhiteBalanceOptions) => Promise<void>Set white balance mode.
| Param | Type |
|---|---|
options | WhiteBalanceOptions |
Interfaces
Section titled “Interfaces”ConnectOptions
Section titled “ConnectOptions”| Prop | Type | Description |
|---|---|---|
ssid | string | WiFi SSID of the Ricoh camera |
password | string | WiFi password of the camera |
PreviewOptions
Section titled “PreviewOptions”| Prop | Type | Description |
|---|---|---|
container | string | HTML element ID for preview container |
CaptureOptions
Section titled “CaptureOptions”| Prop | Type | Description |
|---|---|---|
quality | number | Image quality (1-100) (optional) |
saveToGallery | boolean | Save to device gallery (optional) |
RecordingOptions
Section titled “RecordingOptions”| Prop | Type | Description |
|---|---|---|
maxDuration | number | Maximum recording duration in seconds (optional) |
quality | string | Video quality: ‘high’ | ‘medium’ | ‘low’ (optional) |
CaptureResult
Section titled “CaptureResult”| Prop | Type | Description |
|---|---|---|
filePath | string | Path to the captured file |
fileUrl | string | URL to access the file |
CameraInfo
Section titled “CameraInfo”| Prop | Type | Description |
|---|---|---|
model | string | Camera model name |
serialNumber | string | Camera serial number |
firmwareVersion | string | Firmware version |
batteryLevel | number | Battery level (0-100) |
ExposureOptions
Section titled “ExposureOptions”| Prop | Type | Description |
|---|---|---|
mode | string | Exposure mode: ‘auto’ | ‘manual’ | ‘iso’ |
iso | number | ISO value (100, 200, 400, etc.) (optional) |
shutter | number | Shutter speed (optional) |
WhiteBalanceOptions
Section titled “WhiteBalanceOptions”| Prop | Type | Description |
|---|---|---|
mode | string | White balance: ‘auto’ | ‘daylight’ | ‘cloudy’ | ‘tungsten’ | ‘fluorescent’ |
Terminé Exemple
Section titled “Terminé Exemple”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();Best Practices
Section titled “Best Practices”- Always Initialiser the plugin before connecting to the camera
- Ensure the Appareil is connected to the camera’s WiFi network
- Handle errors gracefully, especially connection failures
- Arrêter preview and disconnect when done to Enregistrer battery
- Vérifier camera battery level before long recording sessions
- Test on actual Ricoh Theta hardware
- Use appropriate video quality based on storage constraints
Dépannage
Section titled “Dépannage”Connection Issues
Section titled “Connection Issues”- Verify the camera is powered on
- Vérifier WiFi SSID and password are correct
- Ensure no other Application is connected to the camera
- Réinitialiser camera WiFi Paramètres if connection fails
Preview Not Showing
Section titled “Preview Not Showing”- Verify the HTML container element exists
- Vérifier camera permissions are granted
- Ensure preview is started after successful connection
Capture Failures
Section titled “Capture Failures”- Vérifier Disponible storage space
- Verify camera battery level is sufficient
- Ensure camera is not in sleep mode