Table of Contents

The Demos

Two demos ship with the extension and can be created from the Toolkit. Both are C# applications that draw their own menu with Ahsoka.Core.Drawing and use nothing from the video API beyond what these pages describe.

Table of Contents

The Pro Demo

The Flex Demo

Patterns Both Demos Use

The Pro Demo

Ahsoka.CS.VideoPlayer targets the OpenView Pro (P100) and configures nine players:

Players Input Ports Surfaces Notes
1–2 GMSL GMSL0, GMSL1 1002, 1003 1920×1200 at 30
3–4 Analog ANALOG0, ANALOG1 1004, 1005 720×480 at 30, deinterlace and horizontal flip on
5–8 VCIC VCIC0 … VCIC3 1006 … 1009 Render size 464×348 — the quad tile
9 File media/demo.mp4 1010 The demo clip, shipped in the application folder; 1024×576 at 128, 110

It is a four-page application: Home, GMSL / Analog, VCIC Cameras and Video File. Entering a page plays that page's players; leaving it stops them, so only one page's feeds run at a time and their surfaces never overlap. The application's own UI is surface 1001.

Read it in this order:

File What it shows
Program.cs Start here. Hosting the service, connecting, GetVideoPlayers, page routing, and the GMSL/Analog page: play the page's players while their surfaces are hidden, then reveal them together. This is the copyable pattern.
VcicSimpleExample.cs The complete minimal VCIC integration — the GetVcicStatus gate plus PlayVideo / StopVideo, with no layout logic. Not wired into the running demo; it is there to read and copy.
Program.Vcic.cs The advanced VCIC page. Optional polish built on the same calls.
Program.cs — PlayVideoFiles, TogglePause, Restart The Video File page.

The VCIC page:

  • Gates its button. While Home is showing, a background loop calls GetVcicStatus() every two seconds; the VCIC button is grey until the display is on the camera subnet and at least one camera is present. On the desktop the button is enabled whenever VCIC players are configured, so the page can be tried without cameras.
  • Lays out only the cameras present — one to four tiles.
  • Promotes on demand. Numbered buttons in the top strip enlarge a camera to a 900×675 main view with the others in a strip; up to two can be promoted at once. Only tiles that cross the 520-pixel tier boundary are re-played at their new size — the others are just moved with the LayerManager.

The demo's package sets the display's Ethernet to 192.168.40.100/24 for the VCIC cameras.

The Video File page:

  • Plays the configured file. The play request has no VideoURL, so player 9 plays media/demo.mp4, which the project copies to its output (see Shipping a File with Your Application).
  • Pause / Play and Restart in the top strip call PauseVideo, ResumeVideo and PositionVideo with PositionInMs = 0. Restart also resumes a paused clip.
  • Shows a readout below the video — position, duration and state — from the player's StatusUpdated notifications.
  • Repeats the clip by playing it again on each Stopped, while the page is showing (see Repeating a File).
  • Draws a placeholder naming the file when PlayVideo returns Unavailable, or a notification reports it after a failure mid-play, so the file reads as "unavailable" rather than as a black page.

The Flex Demo

Ahsoka.CS.VideoPlayerFlex targets the OpenView Flex: four GMSL cameras and a video file, no analog, no VCIC. It is the Pro demo's shape with those pages removed.

Players Source Surface Position (screen 0)
1 GMSL0 1002 40, 100 — 560×350
2 GMSL1 1003 680, 100 — 560×350
3 GMSL2 1004 40, 450 — 560×350
4 GMSL3 1005 680, 450 — 560×350
5 media/demo.mp4 (File) 1007 128, 110 — 1024×576

Three pages: Home, which reports how many GMSL cameras and video files are configured; GMSL Cameras, which plays all four cameras; and Video File, which works like the Pro demo's. On the camera page, a player that comes back Unavailable — a port with no camera — gets a placeholder tile drawn in its place, so a rig with fewer cameras reads as "this port is empty" rather than as a failed page.

Two screens. The Flex package declares three outputs: screen 0 (DSI-1) and screen 1 (LVDS-1) enabled, screen 2 (LVDS-2) disabled. The demo opens a DrawingWindow on each enabled screen — surface 1001 on screen 0 and 1006 on screen 1 — because a screen that shows video needs an application surface covering the rest of the output (see Multiple Screens).

A layout button in the top strip toggles between:

Layout Placement
4-Up All four tiles as a quad on screen 0 — the package configuration
2 + 2 Two 610×381 tiles on each screen, at the same height on both

The toggle is purely a compositor operation — UpdateSurfaceLayer (which carries the screen) and UpdateSurfaceLocation per tile, committed once — so the feeds keep running across the change. Because stopping a feed drops its runtime placement, the layout is re-applied each time the camera page is entered.

Patterns Both Demos Use

Pattern Why
AhsokaRuntime.StartLocalServiceManager() first in Main Hosts VideoService; without it the first request hangs
Connect and call GetVideoPlayers in Task.Run, with a short retry Keeps the UI responsive and covers the service's start-up window
PlayVideo loops in Task.Run PlayVideo can block on bring-up and on the previous feed shutting down
Tiles start hidden, revealed together on Playing (three-second fallback) Feeds appear at once instead of popping in one by one
Play a file again on its Stopped notification, only while its page is showing The service does not loop; a StopVideo of the demo's own also reports Stopped
Hide all of a page's tiles in one commit, then stop them Feeds vanish together instead of one by one over the next page
Controls only in a strip above the tiles Video surfaces take the touches over them
Tile rectangles in PackageInfo.json, not in code Placement is the compositor's job; the code only plays, stops, hides and shows