Open pzimmermaninmo opened 5 years ago
Any update on this? I have the same issue. 100% of the time on all URLs on iOS. If AutoPlay is false, then manually calling Play (or any other player command) has no effect, the video will not start. However, with AutoPlay true, then all calls afterward behave as expected.
Feel like I'm responding to all the issues in this repo.
Yes I'm also having the same issue on iOS. The controls will not appear when autoplay is set to false.
Also, did you ever solve this @barrysohl? What did you try?
Alright, coming back to this.
I found a workaround that works for me but it also feels incredibly unstable and I hate myself for writing it.
videoView.AutoPlay = true;
CrossMediaManager.Current.StateChanged += StopAudioImmediatelyOniOS;
private async void StopAudioImmediatelyOniOS(object sender, StateChangedEventArgs e)
{
if (e.State != MediaPlayerState.Stopped && e.State != MediaPlayerState.Paused)
{
await CrossMediaManager.Current.Pause();
CrossMediaManager.Current.StateChanged -= StopAudioImmediatelyOniOS;
}
}
Thnx a lot @LittleBoxOfChicken
You deserve a BIG box of chicken for this workaround, methinks ;-)
Hola, les comparto una solución:
if (Device.RuntimePlatform == Device.iOS) { CrossMediaManager.Current.BufferedChanged += Current_BufferedChanged; CrossMediaManager.Current.MediaItemFinished += Current_MediaItemFinished; }
private void Current_MediaItemFinished(object sender, MediaManager.Media.MediaItemEventArgs e) { CrossMediaManager.Current.Stop(); CrossMediaManager.Current.Dispose(); Video = new MediaManager.Forms.VideoView { IsFullWindow = true, AutoPlay = true, ShowControls = true, HeightRequest = 200, Source = vm.Datos.Video.UrlArchivo }; }
private void Current_BufferedChanged(object sender, MediaManager.Playback.BufferedChangedEventArgs e) { CrossMediaManager.Current.Pause(); }
So for me, the CrossMediaManage.Current.Play(x); was only working well in Android, but on iOS, it was playing the audio, with a black screen. So the only way I had it work, is somehow refresh the page (maybe is forcing the onAppearing to happen), so please don't laugh, but this worked for me:
if (Device.RunTimePlatform == Device.iOS && shouldPlayVideo) { await Navigation.PushModalAsync(new Page(), false); await Navigation.PopModalAsync(false); }
🐛 Bug Report
Using the VideoView in Xamarin forms, if you set autoplay to false, the video will stay black and never play. Tapping play does nothing at all. I've seen this with two urls so far.
Expected behavior
Video should play when play is pressed or Play() method is called
Reproduction steps
Here is my code to reproduce
Configuration
Version: v0.8.18 iOS 12.4 iPhone 6s Xamarin Forms 4.3 Plugin.MediaManager: v0.8.18 Plugin.MediaManager.Forms: v0.8.18
Platform: