LearnNewsExamplesServices
Frontmatter
id5674
titlecomponent.Video: invalid addDomListeners() definition, ghost should be an overlay
stateClosed
labels
bug
assigneesDinkh
createdAtAug 3, 2024, 8:29 PM
updatedAtAug 10, 2024, 6:41 PM
githubUrlhttps://github.com/neomjs/neo/issues/5674
authortobiu
commentsCount2
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtAug 10, 2024, 6:41 PM

component.Video: invalid addDomListeners() definition, ghost should be an overlay

Closed v8.1.0 bug
tobiu
tobiu commented on Aug 3, 2024, 8:29 PM

Hi Torsten,

        me.addDomListeners(
            {click: me.play, delegate: '.neo-video-ghost'},
            {click: me.pause, delegate: '.neo-video-media'}
        )

is not correct. The method either accepts an object or an array of objects, but not multiple params.

        me.addDomListeners([
            {click: me.play, delegate: '.neo-video-ghost'},
            {click: me.pause, delegate: '.neo-video-media'}
        ])

If you use an array, the pause listener will get added too. However, this brings us to the next problem:

    afterSetPlaying(value, oldValue) {
        let {vdom} = this,
            media = VDomUtil.getFlags(vdom, 'media')[0],
            ghost = VDomUtil.getFlags(vdom, 'ghost')[0];

        ghost.removeDom = value;
        media.removeDom = !value;

        this.update()
    }

Using removeDom on the video node will kick it out of the DOM, and we will use the state of the video. Meaning: you watch it 10s, hit pause, hit play and you will start over at 0s.

=> The ghost should be an overlay and the video node should not get removed.

tobiu added the bug label on Aug 3, 2024, 8:29 PM
tobiu assigned to @Dinkh on Aug 3, 2024, 8:29 PM
tobiu
tobiu Aug 3, 2024, 9:14 PM

follow-up thoughts: it is of course ok to not mount the video node initially, if we start with the "ghost mode".

following idea:

    afterSetPlaying(value, oldValue) {
        // ...
        media.removeDom = !value && oldValue === undefined;
        // ...
    }

without having looked into the styling, the top level node should probably get position: relative and the ghost position: absolute with a higher z-index than the video node.

Dinkh referenced in commit b19488a - "#5674 unnecessary click listener, because the video itself pauses the video on click" on Aug 10, 2024, 6:38 PM
Dinkh referenced in commit 479909c - "#5674 document remaining pause method of video" on Aug 10, 2024, 6:39 PM
Dinkh
Dinkh Aug 10, 2024, 6:41 PM

removed the click event listener, which would lead to pause the video, as the video itself listens to click. The pause method is still in place to allow to pause the video programmatically.

Dinkh closed this issue on Aug 10, 2024, 6:41 PM