grab/superapp-sdk / skills
grabjs-superapp-sdk
VerifiedAPI reference for `@grabjs/superapp-sdk`. Use when building a MiniApp that runs in the Grab SuperApp WebView and needs to call native features (camera, payments, authorization, authentication, permission, location, device storage, container UI customization) via the Grab `JSBridge`. Keywords: miniapp, webview, android, ios, jsbridge, grab, superapp.
references/modules/MediaModule.md
View on GitHub# MediaModule
## API Reference
SDK module for playing DRM-protected media content via `JSBridge`.
| Method | Returns | Description |
| :--- | :--- | :--- |
| `observePlayDRMContent(data: DRMContentConfig)` | `ObserveDRMPlaybackResponse` | Observes DRM-protected media content playback events. |
| `playDRMContent(data: DRMContentConfig)` | `Promise<PlayDRMContentResponse>` | Plays DRM-protected media content in the native media player. |
## `observePlayDRMContent`
Observes DRM-protected media content playback events.
**OAuth Scope:** mobile.media
**Signature:** `observePlayDRMContent(data: DRMContentConfig): ObserveDRMPlaybackResponse`
This stream can emit the following `status_code` values:
- `200` (OK): Stream emitted a playback event. The `result` contains DRMPlaybackEvent.
- `500` (Internal Server Error): Stream emitted an unexpected error.
- `501` (Not Implemented): Requires Grab app environment.
```typescript
import { MediaModule, isSuccess, isError } from '@grabjs/superapp-sdk';
// Initialize the media module
const media = new MediaModule();
// Observe DRM content playback
const subscription = media.observePlayDRMContent({
// DRM content configuration
}).subscribe({
next: (response) => {
if (isSuccess(response)) {
console.log('Playback event:', response.result);
} else if (isError(response)) {
console.error(`Error ${response.status_code}: ${response.error}`);
}
},
complete: () => console.log('Playback completed')
});
// Later, to stop receiving events:
subscription.unsubscribe();
```
## `playDRMContent`
Plays DRM-protected media content in the native media player.
**OAuth Scope:** mobile.media
**Signature:** `playDRMContent(data: DRMContentConfig): Promise<PlayDRMContentResponse>`
This method can return the following `status_code` values:
- `200` (OK): Playback initiated successfully.
- `204` (No Content): Request completed.
- `400` (Bad Request): Invalid request parameters.
- `424` (Failed Dependency): Underlying native request failed.
- `500` (Internal Server Error): An unexpected error occurred.
- `501` (Not Implemented): Requires Grab app environment.
```typescript
import { MediaModule, isSuccess, isError } from '@grabjs/superapp-sdk';
// Initialize the media module
const media = new MediaModule();
// Play DRM content
const response = await media.playDRMContent({
// DRM content configuration
});
// Handle the response
if (isSuccess(response)) {
switch (response.status_code) {
case 200:
console.log('Playback initiated');
break;
case 204:
console.log('Invalid parameters');
break;
}
} else if (isError(response)) {
console.error(`Error ${response.status_code}: ${response.error}`);
} else {
console.error('Unhandled response');
}
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |