Saikat Saha
Saikat Saha

Reputation: 838

Exit full screen HTML5 video player using Android back utton in Phonegap Application

I am having a requirement where I am playing the videos in HTML5 video tag and when in full screen user cant able to back to the application as I have disabled the back button of android how to enable it only for this specific feature and redirect it to a particular page.

Upvotes: 1

Views: 815

Answers (1)

Daan Oerlemans
Daan Oerlemans

Reputation: 245

You can try it like this: override the onKeyDown function and check if you are playing a video, if so it loads a particular page else it does nothing.

Private boolean videoPlayer = false;        
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)  {
    if(keyCode == KeyEvent.KEYCODE_BACK && videoPlayer)
    {
        //load particulair page
    }
    return true;
}

Upvotes: 1

Related Questions