0

Currently I am working on Youtube videos,

I am facing a issue.

One weird thing I observed that the fullscreen option is not available for mobile app. However it is present in browser of mobile (chrome).

I researched a lot on web but didn't find the answer

Please help me, I want that fullscreen functionality

var player = new YT.Player(strId, {
    "height": '200',
    "width": '100%',
    "videoId": 'Hmvz_lKyh',
    "events": {
        "onReady": onPlayerReady,
        "onStateChange": onPlayerStateChange
     },
     "allowfullscreen": true
});
Kiran Shinde
  • 5,732
  • 4
  • 24
  • 41

2 Answers2

1

If you're doing this on an Android app like you mentioned, .setFullscreen(true). You can find a sample implementation in this blog post

@Override
   public void onClick(View arg0) {
    youTubePlayer.setFullscreen(true);
   }});
}

If you're doing this for JS or HTML5 for web, check this SO thread for various ways to implement fullscreen.

Community
  • 1
  • 1
ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56
0

I didn't find any answer on this, So I finally end up with this solution

I have added a button with class "full-screen"

var isFullScreenMode = false;

$(".full-screen").on("click", function() {
    if (isFullScreenMode) {
        $(".video-player").height(200);
        isFullScreenMode = false;
    } else {
        $(".video-player").height($(window).height());
        isFullScreenMode = true;
    }
})
Kiran Shinde
  • 5,732
  • 4
  • 24
  • 41