2 branches
Tree Top files
Code
Clone with HTTPS:
Clone with SSH:
diviocity public alpha release 77754ad9e6dc749afefba326ff89abc5ddd8c9c9 last Oct 31
..
README.md public alpha release last Oct 31 2.03 KB
main.v public alpha release last Oct 31 6.5 KB

host_chrome — the embed with host chrome

A complete host application that embeds vendetta as a ui2 widget. The host owns the window, the layout and the event loop; vendetta is a guest element plus a set of methods the host calls.

Run

# from the vendetta repo root
v examples/host_chrome/main.v

The example locates assets/video/test.mp4 relative to its own file, so it runs from any directory. It queues that clip at startup.

What to try

  • Watch: the video plays on the left pane; the floating control strip appears over it and auto-hides after 2.5 s of pointer rest.
  • Hover / wheel / right-click: all forwarded. The wheel steps volume while over the widget; right-click on the video pauses.
  • Host sidebar (right pane): every control here is host chrome.
    • Floating controls checkbox — switches vendetta between the floating strip and a docked strip through player.set_overlay.
    • Replay video / Stop — host buttons that call player.load and player.stop directly.
    • The labels mirror vendetta's playback state (position, volume, mode) and update every frame because view() just re-reads the player.
  • q — toggles the sidebar, which resizes vendetta's frame. The widget relayouts on the next build, so nothing special is needed from the host.

The host's responsibilities

  1. Build: fold player.build(frame) into your element tree.
  2. Render: register one ui2.set_gl_surface_renderer and route by id — vendetta only answers for libvendetta.video_surface_id.
  3. Input: forward pointer_moved, mouse_button, wheel and key.
  4. Events: in your event callback, forward any event id starting with vd_ to player.handle; handle everything else yourself.
  5. Lifecycle: call player.destroy() after the window is closed.

Multiple players in one process are possible: each libvendetta.Player keeps its own mpv context and surface; only the per-window input hooks are shared, so those routes must fan out to whichever player the pointer is over.