How to stop the video player from playing when moving from one page to another - flutter

I am using video_player package for displaying a video. I have written the video player inside separate class. The issue is, during the video playing, when I try to close the page by pressing back button, a bottomsheet will be presented on the screen. After clicking on the bottom sheet, the user will be navigated to another page. During this process, the audio from the video_player is heard.
If we are not using bottomsheet and directly pressing backbutton, the video_player is properly disposed.
Have anyone encountered this scenario before?

Try calling pop() before navigating to new page from bottom sheet.
Keep me posted.

Related

Flutter Video Player appears on second time webpage loads and overlay buttons not functional

Link: Website
Problem: The video on the front page below the video banner does not render until you navigate away from the page and return back. When the video finally appears and plays, the play button does not work. Is there a way to have the video appear on first appearance and have the overlay work as expected.
I am using the latest video_player widget to play the video. Other videos I have implemented work just fine.
When I debug my flutter web application, the application pauses at videoController.play() inside initState(). I continue execution to see if there is was an exception, but nothing new shows in debug console.
One solution I found to work is by setting the volume to 0 then starting the video.
This allows the video to play, but the overlay still not functioning as expected, so I just removed it. For now it works, but still wondering on how the overlay can be implemented.

How to implement an expanding minplayer in flutter using just audio

I am working on a simple music player app using the just_audio plugin. I want to have a small miniplayer at the bottom of the screen in the app. It will have basic song info and controls to play and pause. The basic deisgn is -:
when the user clicks on the minplayer I want it to expand into a full screen size and show additional controls like a progress bar, buttons to control the player etc. I tried to do this by passing the audioplayer as a navigator argument but got the error which said that only one instance of player is accepted at a time. Also the big screen should have a button to collapse the player
Please help

No back button for Handheld.PlayFullScreenMovie method

I am trying play a fullscreen video in my app (iOS&Android). When users press on video I use the
Handheld.PlayFullScreenMovie method and it displays the videos perfectly. BUT, there is no back button in the player. The only way to exit player and switch back to the scene is to wait untill the video ends. How can I fix this problem? It is so obvious that users may need the back button and idk why Unity does not added it

Flutter - PIP mode similar to Youtube (Android)

I am trying to create an app in flutter which consists of:
Home Page
Video Player Page
From the Home Page, the user is able to navigate to the video player page. If the video is playing, when the user clicks the back button or swipe down from the video player, I want to minimize the video player to the bottom of the app (while continue playing) and navigate back to the homepage. This is how Youtube works right now.
After research, I found two approaches to implement this, but each with its own problems.
1. Use the Android PIP mode
Problem:
Android PIP mode works on activity basis. Flutter has only one activity. If I were to implement it this way, the entire app will be minimized when I invoke the PIP mode. I want the user to be able to navigate within the app while the video player is in PIP mode.
Is there a way to have more than one activity in Flutter? If it is possible, then is it advisable to implement it this way?
2. Create a persistent widget
Create a widget that persists on navigation similar to this.
Problem:
I can't wrap my head on how to implement it this way. How do I animate the media player in the nested MaterialApp to minimize to the bottom of the app where the persistent widget is (because it's two separate Material Apps). How do I pass data between them?

YouTube javascript API accessible via UIWebView on iPad?

I can't seem to get this working using stringByEvaluatingJavascriptFromString. Apparently the webview does something peculiar to youtube videos (due to the YouTubePlugIn.webplugin perhaps?) and the javascript API is unusable.
The problem I'm having: How do I pause\stop a video when the user navigates away from a UIWebView with an embedded YouTube video?
Right now the only thing I can think off is reloading the view from a string before navigating away... but that seems heavy and hackish.
Has anyone had any luck with this?
Loading an empty string is the only thing I have found that works right now.
I am trying to play the video in a popover, and clicking off the popover (closing it), causes the sound to still play in the background until a new video is selected. The solution to this is to load an empty string. Unfortunately, if they fullscreen, clicking off the popover to close it (because it sits on top of the fullscreen video) loads the empty string, and then the entire application crashes. :(