muslimtv / flutter_playout

AV Playout in Flutter
BSD 3-Clause "New" or "Revised" License
154 stars 93 forks source link

Full screen feature for Android #54

Open enesgur opened 4 years ago

enesgur commented 4 years ago

Hi there,

There is no full screen button now but it can be an important feature for android.

KhuramKhalid commented 4 years ago

There isn't such functionality built in the player but this is something your app can handle. See below code to programmatically toggle fullscreen.

if (widget.orientation == Orientation.landscape) {
    await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
    await SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
} else {
    await SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]);
    await SystemChrome.setEnabledSystemUIOverlays([]);
}

You can have a fullscreen button on top of the player that can do this. You will also need to give all available screen space to the player so that the player widget expands to screen edge giving a fullscreen effect.

enesgur commented 4 years ago

There isn't such functionality built in the player but this is something your app can handle. See below code to programmatically toggle fullscreen.

if (widget.orientation == Orientation.landscape) {
    await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
    await SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
} else {
    await SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]);
    await SystemChrome.setEnabledSystemUIOverlays([]);
}

You can have a fullscreen button on top of the player that can do this. You will also need to give all available screen space to the player so that the player widget expands to screen edge giving a fullscreen effect.

thank you.