I want to know how to control the video when the view movement is over

I am sending you a video file by email. @jan

  1. I want to play the video when I arrive at the view when the video is turned off.
  2. Conversely, when the movie is turned on, the video stops after moving the view through the code. However, after you turn off the movie, it is not played through the trigger button either.
viewer.onViewSwitchDone(function (viewName) {
      var videoTexture = viewer.findMaterial("Painting 03").baseColorTexture;
      videoTexture.video.addEventListener("ended", function () {
        viewer.switchToView("p2");
      });
      if (viewName === "p2" && videoTexture.isPlaying === true) {
        videoTexture.video.pause();
        
      } else {
        videoTexture.video.play();
      }

      return true;
    });

You need to control the playing and pausing of the video by higher level functions in the material. If you use play and pause on the video element the state becomes incorrect, instead use:

var videoMaterial = viewer.findMaterial("Painting 03");
videoMaterial.play();
videoMaterial.pause();
videoMaterial.isPlaying;