hrajchert / angular-screenfull

Angular binding to the Screenfull library to allow fullscreen in your app.
http://hrajchert.github.io/angular-screenfull/
MIT License
60 stars 16 forks source link

FullScreen for Multiple Video Player #13

Closed slimshadddyyy closed 7 years ago

slimshadddyyy commented 8 years ago

Hi, How do I use this plugin for multiple video players. For example the below code will work for single player or div that will be displayed fullscreen


<div ngsf-fullscreen="fullscreenCtrl">
Content Goes Here
<button ng-click="fullscreenCtrl.toggleFullscreen()"/>
</div>

For multiple, I tried below code and passed uniq id but its not working and full screen is applied on last element.

<div ngsf-fullscreen="fullscreenCtrl">
Content Goes Here
<button ng-click="fullscreenCtrl.toggleFullscreen('myUniqId')"/>
</div>

Please guide and help on how to make it work for multiple instances to be full screened.

Thanks !

hrajchert commented 8 years ago

Hi! the ngsf-fullscreen directive exposes its controller under the name given. In this particular case you are exposing both controllers as fullscreenCtrl, which means that ones is going to overwrite the other one.

Also the method toggleFullscreen doesn't have a parameter.

You should do something like

<div ngsf-fullscreen="ctrl1">
First Content Goes Here
<button ng-click="ctrl1.toggleFullscreen()"/>
</div>

<div ngsf-fullscreen="ctrl2">
Second Content Goes Here
<button ng-click="ctrl2.toggleFullscreen()"/>
</div>