angularhtml5-videovideogularhtml5-fullscreen

Videogular2 control outside <vg-player> element


Is there a way to use a controler outside the <vg-player></vg-player> element?

I'm trying to make a fullscreen button outside the <vg-player> like following:

<vg-controls>
    <vg-fullscreen></vg-fullscreen>
  </vg-controls>

  <vg-player>
    <vg-controls>
      <vg-fullscreen></vg-fullscreen>
    </vg-controls>
    <video [vgMedia]="media" #media id="singleVideo" preload="auto"  autoplay>
      <source src="assets/videos/mov_bbb.mp4" type="video/mp4"/>
    </video>
  </vg-player>´

This because I want this button on another place, not ontop of the video.

The code above gives me following Error: ERROR TypeError: Invalid event target


Solution

  • Found solution myself.

    using the videogular2 API.

        <vg-player (onPlayerReady)="onPlayerReady($event)">
           <video> <source srcs="myvideo"/></video
        </vg-player>
    
    fullscreen() {
            this.vg.fsAPI.toggleFullscreen();
        }