Preparing search index...

    Widget for displaying video content.

    export class VideoViewPanel extends PanelPlugin {
    connections: any[];
    static descriptor() {
    const d = new Descriptor();
    d.id = 'com.docs.VideoViewExample';
    d.name = 'VideoView Example';
    d.defaultDockState = DockState.Detached;
    d.defaultSize = new Size(400, 350);
    return d;
    }
    constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
    super(pluginSystem, descriptor);
    this.connections = [];
    }
    createWidget(parent: Widget): Widget {
    const root = new Widget(parent);
    const layout = new BoxLayout();
    layout.setDirection(Direction.TopToBottom);
    layout.spacing = 8;
    root.layout = layout;

    const title = new Label(root);
    title.text = 'VideoView Demo';
    title.fontRole = FontRole.TitleBold;
    layout.addWidget(title);

    // VideoView embeds a video player in the panel
    const video = new VideoView(root);
    video.setSource(new Editor.Path('preview.mp4'));
    video.loopCount = -1;
    video.muted = true;
    video.setMinimumHeight(200);
    layout.addWidget(video);

    const playBtn = new PushButton(root);
    playBtn.text = 'Play';
    layout.addWidget(playBtn);

    const pauseBtn = new PushButton(root);
    pauseBtn.text = 'Pause';
    layout.addWidget(pauseBtn);

    this.connections.push(
    playBtn.onClick.connect(() => {
    video.play();
    }),
    pauseBtn.onClick.connect(() => {
    video.pause();
    }),
    video.onPositionChanged.connect((pos: number) => {
    console.log('Position:', pos);
    })
    );

    return root;
    }
    deinit(): void {
    this.connections.forEach((c: any) => c?.disconnect());
    this.connections = [];
    }
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    autoFillBackground: boolean

    Whether the widget automatically fills its background before painting.

    backgroundRole: ColorRole

    The color role used for the widget's background.

    className: string
    contextMenuPolicy: ContextMenuPolicy

    Controls how the widget handles context menu requests.

    devicePixelRatio: number

    The ratio between physical and logical pixels for the widget's display.

    duration: number

    Total duration of the loaded video in seconds.

    enabled: boolean

    Whether the widget is interactive and accepts user input.

    fontRole: FontRole

    The font role applied to the widget's text rendering.

    foregroundRole: ColorRole

    The color role used for the widget's foreground elements.

    hasFocus: boolean
    height: number

    Current height of the widget in pixels.

    hidden: boolean

    Whether the widget is hidden from view.

    isNull: boolean

    True if the underlying native widget object has been destroyed.

    isTransparentForMouseEvents: boolean
    layout: Layout

    The layout manager assigned to arrange child widgets.

    loopCount: number

    Number of times the video will loop; -1 for infinite looping.

    muted: boolean

    Whether the video audio is muted.

    objectName: string
    onClick: signal0<void>

    Callback fired when the video view is clicked.

    onClose: signal1<CloseEvent, void>

    Signal emitted when the widget is closed.

    onFocusIn: signal0<void>
    onFocusOut: signal0<void>
    onHide: signal0<void>

    Signal emitted when the widget becomes hidden.

    onHover: signal1<boolean, void>

    Callback fired when the pointer enters or leaves the video view.

    onKeyPress: signal1<number, void>

    Signal emitted when a key is pressed while the widget has focus.

    onMouseDoubleClick: signal1<MouseEvent, void>

    Signal emitted when the user double-clicks on the widget.

    onMouseMove: signal1<MouseEvent, void>

    Signal emitted when the mouse moves over the widget.

    onMousePress: signal1<MouseEvent, void>

    Signal emitted when a mouse button is pressed on the widget.

    onMouseRelease: signal1<MouseEvent, void>

    Signal emitted when a mouse button is released on the widget.

    onPositionChanged: signal1<number, void>

    Callback fired when the playback position changes.

    onResize: signal2<number, number, void>

    Signal emitted when the widget is resized.

    onShow: signal0<void>

    Signal emitted when the widget becomes visible.

    onStateChanged: signal1<any, void>

    Callback fired when the playback state changes.

    position: number

    Current playback position in seconds.

    radius: number

    Corner radius of the video view widget.

    responseHover: boolean

    Whether the widget responds to hover events.

    state: any

    Current playback state of the video.

    toolTip: string

    Text displayed in a tooltip when the user hovers over the widget.

    visible: boolean

    Whether the widget is currently visible.

    volume: number

    Playback volume level, from 0.0 to 1.0.

    width: number

    Current width of the widget in pixels.

    windowTitle: string

    Title text displayed in the widget's title bar when shown as a window.

    Methods

    • Brings the widget's top-level window to the foreground and gives it focus.

      Returns void

    • Resizes the widget to fit its contents based on the size hint.

      Returns void

    • Blocks or unblocks signal emission from the widget.

      Parameters

      • blocked: boolean

      Returns void

    • Closes the widget, hiding it and emitting the onClose signal.

      Returns void

    • Schedules the widget for deletion after the current event loop iteration.

      Returns void

    • Parameters

      • name: string

      Returns any

    • Returns the name of this object's type.

      Returns string

    • Captures the widget's current rendered content as a Pixmap.

      Returns Pixmap

    • Returns true if the object is of the specified type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object refers to the same instance as the given object.

      Parameters

      Returns boolean

    • Moves the widget to the specified position.

      Parameters

      • ax: number
      • ay: number

      Returns void

    • Pauses the currently playing video.

      Returns void

    • Starts or resumes video playback.

      Returns void

    • Raises the widget to the top of the parent widget's stack.

      Returns void

    • Resizes the widget to the specified width and height.

      Parameters

      • width: number
      • height: number

      Returns void

    • Sets the margins around the widget's contents.

      Parameters

      • left: number
      • top: number
      • right: number
      • bottom: number

      Returns void

    • Sets a custom pixmap as the cursor when the mouse is over the widget.

      Parameters

      Returns void

    • Locks the widget's height to the given value, preventing resizing.

      Parameters

      • height: number

      Returns void

    • Locks the widget's width to the given value, preventing resizing.

      Parameters

      • width: number

      Returns void

    • Gives keyboard input focus to the widget.

      Returns void

    • Sets the maximum height the widget can be resized to.

      Parameters

      • height: number

      Returns void

    • Sets the maximum width the widget can be resized to.

      Parameters

      • width: number

      Returns void

    • Sets the minimum height the widget must maintain.

      Parameters

      • height: number

      Returns void

    • Sets the minimum width the widget must maintain.

      Parameters

      • width: number

      Returns void

    • Parameters

      • name: string
      • value: any

      Returns boolean

    • Sets the video file to play from the given path.

      Parameters

      Returns void

    • Marks property changes on this widget as undoable via the undo stack.

      Parameters

      • undoable: boolean

      Returns void

    • Marks property changes on this widget and all its children as undoable.

      Parameters

      • undoable: boolean

      Returns void

    • Makes the widget visible.

      Returns void

    • Stops video playback and resets to the beginning.

      Returns void

    • Resets the cursor to the parent widget's cursor.

      Returns void