시작하기
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 sync플랫폼 구성
Section titled “플랫폼 구성”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”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" />지원되는 장치
Section titled “지원되는 장치”이 플러그인은 Ricoh Theta 시리즈 카메라를 지원합니다:
- 리코 세타 V -리코 세타 Z1
- 리코 세타 SC2
- 리코 세타 X
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 참조
Section titled “API 참조”initialize() => Promise<void>카메라 플러그인을 초기화합니다.
연결(옵션)
Section titled “연결(옵션)”connect(options: ConnectOptions) => Promise<void>WiFi를 통해 Ricoh Theta 카메라에 연결하세요.
| 파람 | 유형 |
|---|---|
options | ConnectOptions |
연결 해제()
Section titled “연결 해제()”disconnect() => Promise<void>카메라에서 연결을 끊습니다.
시작미리보기(옵션)
Section titled “시작미리보기(옵션)”startPreview(options: PreviewOptions) => Promise<void>실시간 360° 미리보기 스트리밍을 시작하세요.
| 파람 | 유형 |
|---|---|
options | PreviewOptions |
미리보기 중지()
Section titled “미리보기 중지()”stopPreview() => Promise<void>실시간 미리보기 스트림을 중지합니다.
캡처사진(옵션?)
Section titled “캡처사진(옵션?)”capturePhoto(options?: CaptureOptions) => Promise<CaptureResult>360° 사진을 촬영하세요.
| 파람 | 유형 |
|---|---|
options | CaptureOptions(선택 사항) |
반품: Promise<CaptureResult>
녹음 시작(옵션?)
Section titled “녹음 시작(옵션?)”startRecording(options?: RecordingOptions) => Promise<void>360° 비디오 녹화를 시작합니다.
| 파람 | 유형 |
|---|---|
options | RecordingOptions(선택 사항) |
녹음 중지()
Section titled “녹음 중지()”stopRecording() => Promise<CaptureResult>비디오 녹화를 중지합니다.
반품: Promise<CaptureResult>
getCameraInfo()
Section titled “getCameraInfo()”getCameraInfo() => Promise<CameraInfo>카메라 정보와 기능을 얻으세요.
반품: Promise<CameraInfo>
setExposure(옵션)
Section titled “setExposure(옵션)”setExposure(options: ExposureOptions) => Promise<void>카메라 노출 설정을 지정합니다.
| 파람 | 유형 |
|---|---|
options | ExposureOptions |
setWhiteBalance(옵션)
Section titled “setWhiteBalance(옵션)”setWhiteBalance(options: WhiteBalanceOptions) => Promise<void>화이트 밸런스 모드를 설정합니다.
| 파람 | 유형 |
|---|---|
options | WhiteBalanceOptions |
| 소품 | 유형 | 설명 |
|---|---|---|
ssid | string | Ricoh 카메라의 WiFi SSID |
password | string | 카메라의 WiFi 비밀번호 |
미리보기 옵션
Section titled “미리보기 옵션”| 소품 | 유형 | 설명 |
|---|---|---|
container | string | HTML 미리보기 컨테이너의 요소 ID |
캡처 옵션| 소품 | 유형 | 설명 |
Section titled “캡처 옵션| 소품 | 유형 | 설명 |”| -------------- | ------------------ | ------------------------ |
| quality | number | 이미지 품질(1-100)(선택 사항) |
| saveToGallery | boolean | 장치 갤러리에 저장(선택 사항) |
| 소품 | 유형 | 설명 |
|---|---|---|
maxDuration | number | 최대 녹화 시간(초)(선택 사항) |
quality | string | 비디오 품질: ‘높음’ | ‘중간’ | ‘낮음’(선택 사항) |
| 소품 | 유형 | 설명 |
|---|---|---|
filePath | string | 캡처된 파일의 경로 |
fileUrl | string | 파일에 액세스하기 위한 URL |
| 소품 | 유형 | 설명 |
|---|---|---|
model | string | 카메라 모델명 |
serialNumber | string | 카메라 일련번호 |
firmwareVersion | string | 펌웨어 버전 |
batteryLevel | number | 배터리 수준(0-100) |
| 소품 | 유형 | 설명 |
|---|---|---|
mode | string | 노출 모드: ‘자동’ | ‘수동’ | ‘이소’ |
iso | number | ISO 값(100, 200, 400 등)(선택 사항) |
shutter | number | 셔터 속도(옵션) |
화이트밸런스 옵션
Section titled “화이트밸런스 옵션”| 소품 | 유형 | 설명 |
|---|---|---|
mode | string | 화이트 밸런스: ‘자동’ | ‘일광’ | ‘흐림’ | ‘텅스텐’ | ‘형광’ |
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();- 카메라에 연결하기 전에 항상 플러그인을 초기화하세요.
- 장치가 카메라의 WiFi 네트워크에 연결되어 있는지 확인하십시오.
- 오류, 특히 연결 실패를 적절하게 처리합니다.
- 미리보기를 중지하고 완료되면 배터리를 절약하기 위해 연결을 끊습니다.
- 장시간 녹화 세션 전에 카메라 배터리 잔량을 확인하세요.
- 실제 Ricoh Theta 하드웨어에서 테스트
- 저장 공간 제약에 따라 적절한 비디오 품질을 사용하십시오.
- 카메라 전원이 켜져 있는지 확인하세요.
- WiFi SSID와 비밀번호가 올바른지 확인하세요.
- 카메라에 다른 앱이 연결되어 있지 않은지 확인하세요.
- 연결이 실패하면 카메라 WiFi 설정을 재설정합니다.
미리보기가 표시되지 않음
Section titled “미리보기가 표시되지 않음”- HTML 컨테이너 요소가 존재하는지 확인하세요.
- 카메라 권한이 부여되었는지 확인하세요.
- 연결 성공 후 미리보기가 시작되는지 확인하세요.
캡처 실패- 사용 가능한 저장 공간 확인
Section titled “캡처 실패- 사용 가능한 저장 공간 확인”- 카메라 배터리 잔량이 충분한지 확인하세요.
- 카메라가 절전 모드에 있지 않은지 확인하세요.