After entering VR, the video cannot be played when using the controller to click the button

Hello everyone, I am a beginner. I have initially implemented video texture playback through forum tutorials. When testing on the desktop, it can play normally after clicking the button.
But after entering VR, using the handle to click the button cannot play the video.

I also encountered a similar question raised by this post. The answer seems to involve Input controls. How to integrate these codes?

My unfinished project address is
https://playcanvas.com/project/1155224/overview/vr-videotexture

The requirement is to click the Play button to play the video in VR and click the Stop button to stop playing the video.

Can anyone help solve these problems? Thanks

Hi @cyhunter_cy ,

The play button works fine for me. Even in XR.

To pause the video you could add another attribute to link your stop button entity.



VideoTexture.attributes.add('stopButtonEntity', {
    title: 'Stop Button Entity',
    type: 'entity'
});

Then add this to your VideoTexture initialize.

var stopButton = this.stopButtonEntity.button;

stopButton.on('click', function(e) {
    video.pause();
    console.log("video paused");
}, this);

Thank you very much, the code works

1 Like