Loading…

Dartvel, home
Docs
Features
Studio
Cloud
Compared

Search the site

GitHub
pub.dev

GETTING STARTED

Getting started
Existing Flutter apps
Existing Native apps
Run on your phone

APP

UI and styling
Class widgets
Routing
State
Accessibility
Keyboard shortcuts
Localization
Devices and desktop
Native device access
Media, 3D and XR

DATA

Data models
Forms
Search
Sync and offline
Import and export
Change capture
Database
Cache
File storage
Images
Privacy and erasure

BACKEND

Backend functions
Auth and sessions
Authorization
Queues and jobs
Workers and memory
Notifications and mail
Outbound HTTP
AI
Webhooks
GraphQL and OpenAPI
API keys and OAuth
Multi-tenancy
Billing and commerce
Modules

OPERATIONS

Edge security
Secrets and environments
Monitoring
OpenTelemetry
Releases

SHIPPING

Build targets
Static web hosting
Servers and deploying

REFERENCE

Testing
CLI reference
Coding agents

APP

Media, 3D and XR

Players, recorders, 3D scenes and spatial windows share one rule: their state moves only when the device confirms it.

Add dartvel_scene and enable scene3d to render scenes through Flutter Scene. Browser rendering is verified; native rendering depends on Flutter GPU support. Most targets have no native player or headset binding yet, and each section says which.

ON THIS PAGE

Play audio and video, and record

Show the camera, take photos and record

Record or stream part of the screen

Describe a 3D scene

Open a window in space

Play audio and video, and record

DVBox.video and DVBox.audio own their player while they are on screen, and release it when the page closes.

A player is not playing until the device says so, and a recording cut short by the app going to the background ends as interrupted, with the partial file kept.

Protected content with no DRM adapter is refused up front, never played broken.

Captions are WebVTT or SubRip files, shown as real text over the picture, so a screen reader reads them and Ctrl+F finds them.

The built-in controls are labelled buttons in Tab order; a focused player answers k or space, j, l, m and c.

A session puts the player on the lock screen, and its buttons drive the same player.

Remote files are read through a disk cache, and precache fetches the start of a video before anyone presses play.

loop: true starts a video or song again from the beginning when it ends, for a background that plays all through a service.

// Playback is a mode of the box, so the box keeps its size, modifiers,
// gestures and semantics, and the source says what is played.
// The box's element owns the player, so leaving the page releases the
// decoder and the audio focus with it.
Widget trailer() => DVBox.video(
      const DVMediaSource.url('https://cdn.example.com/trailer.mp4'),
      captions: DVCaptions.track(
        'en',
        const DVMediaSource.url('https://cdn.example.com/trailer.en.vtt'),
      ),
      session: const DVMediaSession(title: 'Launch trailer'),
    ).modifier(const DVModifier().width(640));

Copy code to clipboard

// The first megabyte is on disk before the page that plays it opens.
Future<bool> warmTrailer() => DV.Platform.media.precache(
      const DVMediaSource.url('https://cdn.example.com/trailer.mp4'),
      bytes: 1024 * 1024,
    );

Copy code to clipboard

Partial

Spec section: Media Playback and Capture

Planned work and implementation limits

Linux plays through GStreamer and draws video frames by copying each one, with no hardware path yet, so very large video is heavy on the processor. Linux has no lock-screen controls yet.

The browser player and camera are written but not yet checked in a real browser.

Android has generated Media3/CameraX bridges and JNI adapters, with unit-tested controller contracts. Playback, physical cameras and lock-screen controls need a device run. No Android screen capture or widget encoder yet.

Apple event decoding is unit-tested, but iOS/macOS have no AVPlayer/AVFoundation backend or verified Apple build. No native player or camera backend for Windows or TVs.

No casting.

Show the camera, take photos and record

DVBox.camera opens the camera while it is on screen, closes it when the page closes or the app goes to the background, and opens it again when the app comes back.

It is not ready until the device says so; a refused permission is a typed error, never an empty picture.

Photos and clips are written where only your app can read them, and a clip is the same recording session recordVideo gives.

Widget scanner(void Function(DVFile photo) keep) =>
    DVBox.camera(lens: .back, onPhoto: keep);

Copy code to clipboard

With more than one camera, list them and open the one you want. The screen is opened the same way, as a lens.

// Two webcams, a capture card and the screen, by the names the system
// gives them. The id is what the box opens.
Future<List<DVCameraDevice>> sources() => DV.Platform.media.cameras();

Widget stageCamera(DVCameraDevice device) =>
    DVBox.camera(lens: device.lens, device: device.id, controls: .none);

// The display, previewed and recorded like a camera.
Widget sharedScreen() => DVBox.camera(lens: .screen, controls: .none);

Copy code to clipboard

Partial

Spec section: Media Playback and Capture

Planned work and implementation limits

Linux cameras are webcams and capture cards (V4L2). The screen can be shared on X11 and in a browser. Wayland is not supported yet.

The Linux camera was checked with a test picture source; no physical webcam was on the test machine.

Record or stream part of the screen

DVBox.recorded marks what to record. Nothing changes on screen.

start() records to a private MP4; start(streamTo:) sends it live to the RTMP address a streaming service gives you.

Frames are what the box draws, at a fixed size. When the device falls behind, a frame is skipped so the recording stays in time.

DV.Platform.media.recordingCapabilities says what this device can do; start() refuses with DVRecordingUnavailable where it cannot.

// Whatever the box draws -- a video, a camera, a lyric slide -- is what is
// recorded, at 720 lines.
final DVWidgetRecorder program = DVWidgetRecorder(quality: .hd720);

Widget programOut(Widget live) => DVBox.recorded(recorder: program, child: live);

// A private MP4 when it stops.
Future<void> record() => program.start();
Future<DVFile?> finish() => program.stop();

// Or live, to the RTMP URL and key a streaming service gives you.
Future<void> goLive(Uri ingest) => program.start(streamTo: ingest);

Copy code to clipboard

Partial

Spec section: Media Playback and Capture

Planned work and implementation limits

Recording and streaming work on Linux only so far.

Streaming has been checked against an RTMP server on the same computer. It has not yet been tried with YouTube or Facebook.

Describe a 3D scene

flutter pub add dartvel_scene
dartvel build web

Copy code to clipboard

# pubspec.yaml
dartvel:
  scene3d:
    enabled: true

Copy code to clipboard

Enable scene3d before building. Dartvel installs the renderer and switches Flutter GPU on for native builds automatically.

A scene is a document of nodes, cameras and glTF assets with stated units and axes, and it round-trips exactly.

Tapping picks the node under the finger by its real shape.

Assets must come from your own storage or listed hosts, with a digest that is checked before use.

Set dartvel.scene3d.enabled: true and add dartvel_scene: scenes then render through Flutter Scene, on Flutter GPU natively and WebGL2 in the browser, and the build switches Flutter GPU on for each platform for you.

Boxes, spheres and planes take small JSON materials (base colour, metal, roughness, glow); glTF models load as they are.

Where a device has no GPU support, the scene shows its poster and says why. It never shows a hole.

// A scene is a list of nodes, so what is in it is data a page builds rather
// than a sequence of calls into a renderer. The viewport reports how it had
// to degrade instead of quietly drawing less.
Widget mug(DVSceneAsset model) => DVBox.scene(
      DVScene(
        label: 'A stoneware mug, turning',
        nodes: <DVSceneNode>[
          DVModel3D(model).id('mug'),
          DVSceneCamera.orbit(distance: 2.5, controls: true),
          DVLight.directional(direction: const DVVec3(-1, -2, -1)).shadows(),
        ],
      ),
    );

Copy code to clipboard

Partial

Spec section: 3D Scenes

Planned work and implementation limits

Environment maps, textures and .fmat shader materials are planned.

No animation, physics or build-time asset import.

Checked in a browser; Linux, Android, iOS, macOS and Windows are not yet checked on a device.

Open a window in space

A window can be a volume or an immersive space, with comfort settings, on a headset or glasses.

Passthrough asks for the camera first, and a world anchor is kept only with consent.

Partial

Spec section: XR: Spatial Presentation

Planned work and implementation limits

No native XR binding on any target yet, so spatial windows are not available on a device.

No dartvel build target for Android XR. Meta Horizon and visionOS build as 2D panels with a Dartvel Cloud plan.

PREVIOUS Native device access DV.Platform: camera, location, files, windows and the rest of the device
NEXT Data models One class gives you storage, forms, tables and pages
GitHub
pub.dev
npm
Acknowledgements
Privacy
Terms

FSL-1.1-MIT licensed. Built with Dartvel.

Dartvel is made by

SigmaDev Digital

To the bottom