Richtlinie
Tutorial zur Bildschirmorientierung
Mit @capgo/capacitor-screen-orientation
Capacitor Bildschirmorientierung-Plugin-Schnittstelle.
Installieren
bun add @capgo/capacitor-screen-orientation
bunx cap sync
Was dieses Plugin enthüllt
orientation- Aktuelle Bildschirmorientierung abrufen.lock- Bildschirmorientierung auf eine bestimmte Art sperren.unlock- Bildschirmorientierung entsperren.startOrientationTracking- Geräteorientierung mit Bewegungssensoren verfolgen.
Beispielhafte Verwendung
orientation
Aktuelle Bildschirmorientierung abrufen.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
const result = await ScreenOrientation.orientation();
console.log('Current orientation:', result.type);
lock
Die Bildschirmorientierung auf eine bestimmte Art festlegen.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
// Standard lock
await ScreenOrientation.lock({ orientation: 'landscape' });
// Lock with motion tracking on iOS
await ScreenOrientation.lock({
orientation: 'portrait',
bypassOrientationLock: true
});
unlock
Die Bildschirmorientierung freigeben.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
await ScreenOrientation.unlock();
startOrientationTracking
Mit Bewegungssensoren die Bildschirmorientierung verfolgen.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
await ScreenOrientation.startOrientationTracking({
bypassOrientationLock: true
});
// Listen for changes
ScreenOrientation.addListener('screenOrientationChange', (result) => {
console.log('Orientation changed:', result.type);
});
Vollständige Referenz
- GitHub https://github.com/Cap-go/capacitor-Bildschirmorientierung/
- Dokumentation: /docs/plugins/bildschirmorientierung/
Weitermachen von Using @capgo/capacitor-Bildschirmorientierung
Wenn Sie Mit @capgo/capacitor-Bildschirmorientierung native Medien und Schnittstellenverhalten planen, verbinden Sie es mit @capgo/capacitor-Bildschirmorientierung für die Implementierungsdetails in @capgo/capacitor-Bildschirmorientierung, Einstieg für die Implementierungsdetails in Einstieg, Mit @capgo/capacitor-Live-Aktivitäten für die native Fähigkeit in Mit @capgo/capacitor-Live-Aktivitäten, @capgo/capacitor-Live-Aktivitäten für die Implementierungsdetails in @capgo/capacitor-Live-Aktivitäten und Mit @capgo/capacitor-Video-Player für die native Fähigkeit in Mit @capgo/capacitor-Video-Player.