Search code examples
androidangularcordovaback-buttonvideogular

Videogular2 with android back button doesn't go back to the app


I'm developing a mobile app with cordova and Angular, and I have videos on the app

I used Videogular with the following code

 <vg-player vg-responsive="true" (onPlayerReady)="onPlayerReady($event)">

                    <vg-overlay-play></vg-overlay-play>
                    <vg-buffering></vg-buffering>

                    <vg-scrub-bar>
                        <vg-scrub-bar-current-time></vg-scrub-bar-current-time>
                        <vg-scrub-bar-buffering-time></vg-scrub-bar-buffering-time>
                    </vg-scrub-bar>


                    <vg-controls>
                            <vg-play-pause></vg-play-pause>

                            <vg-time-display vgProperty="current" vgFormat="mm:ss"></vg-time-display>

                            <vg-scrub-bar style="pointer-events: none;"></vg-scrub-bar>

                            <vg-time-display vgProperty="left" vgFormat="mm:ss"></vg-time-display>
                            <vg-time-display vgProperty="total" vgFormat="mm:ss"></vg-time-display>

                            <vg-mute></vg-mute>
                            <vg-fullscreen></vg-fullscreen>

                    </vg-controls>



                    <video [vgMedia]="media" #media id="singleVideo" preload="auto"  [poster]="urlbaseImages+programmeData.imagen" >
                        <source [src]="_domSanitizer.bypassSecurityTrustUrl(programmeData.url)" type="video/mp4">
                    </video>
            </vg-player>

With android (I don't know if this happens too on iOS yet) when I open a video with fullscreen, then if I tap the back button the app closes

is there a way to make the back button to only close the video but stay on the app?


Solution

  • Seems a bug, I found a workaround here https://github.com/apache/cordova-android/pull/823