Baseflow / Baseflow/XamarinMediaManager

Some of common video type unable to play

Open
#659 2 comments 1 reaction 0 assignees View on GitHub
need investigation
Dominant language
C#
Stars
763
Forks
299
PR merge metrics
No merged PRs in 30d

Description

## 🐛 Bug Report

Unable to play some of common video type.

### Expected behavior
Common known video type should able to play

### Reproduction steps
I have download multiple sample of video type and place it on my removable mass storage (USB Drive) and run my xamarin.forms on android device to get every file on my usb to be play on screen.

```
// Private declaration
private readonly List ListVideoExtension = new List() { ".WMV", ".MP4", ".AVI", ".MPEG", ".AVI", ".MPG", ".3GP", ".FLV", ".M4V", ".MKV", ".MOV", ".MTS", ".VOB", ".WEBM", ".OGV" };

//Methods
private int TransitionTime = 10000;
#region MEDIA PLAYER
private void DeclareMediaManagerHandler()
{
try
{
CrossMediaManager.Current.MediaItemFailed += Current_MediaItemFailed;
CrossMediaManager.Current.MediaItemFinished += Current_MediaItemFinished;
}
catch (Exception ex)
{
Console.WriteLine($"[{TAG}] Error declare media manager handler. " + ex);
}
}
private async void PlayMediaFile()
{
try
{
Indx = 0;
while (true)
{
var files = ListMediaFile[Indx];
MediaFileName = Path.GetFileName(files);
IsVideoVisible = false;
if (ListVideoExtension.FirstOrDefault(o => o.Contains(Path.GetExtension(files).ToUpper())) != null)
{

if (File.Exists(files))
{
IsVideoVisible = true;
IsVideoBusy = true;
MediaManager.CrossMediaManager.Current.Play(files);
while (IsVideoBusy) { if (IsVideoBusy == false) break; }
if (IsVideoProperFinish)
goto SKIPFORVIDEO;
}
else
{
LabelVisible = true;
LabelMessage = "Current video resource not exist on selected directory.";
Console.WriteLine($"[{TAG}] Current video resource not exist on selected directory. Path: {files}");
}
}
await Task.Delay(TransitionTime);
SKIPFORVIDEO:
Indx++;
if (Indx == ListMediaFile.Count)
{
Indx = 0;
}
}
}
catch (Exception ex)
{
Console.WriteLine($"[{TAG}] Error on play file. " + ex);
Toast("Error on play file. " + ex.Message, ToastStyle.Error, Plugin.Toast.Abstractions.ToastLength.Long);
}
}
#endregion
#region MEDIA MANAGER EVENT
private void Current_MediaItemFinished(object sender, MediaManager.Media.MediaItemEventArgs e)
{
IsVideoBusy = false;
IsVideoProperFinish = true;
}
private void Current_MediaItemFailed(object sender, MediaManager.Media.MediaItemFailedEventArgs e)
{
IsVideoBusy = false;
IsVideoProperFinish = false;
LabelMessage = "Unable to play video file";
LabelVisible = true;
}
#endregion
```

As on my code, below are the result:
**ABLE TO PLAY**
".MP4", ".MPEG", ".MPG", ".3GP", ".M4V", ".MKV", ".MOV", ".MTS", ".VOB", ".WEBM"

**FAILED TO PLAY**
".WMV", ".AVI", ".FLV", ".OGV"

Sample video download from [here](https://standaloneinstaller.com/blog/big-list-of-sample-videos-for-testers-124.html).

### Configuration

**Version:** 1.x

**Platform:**
- [ ] :iphone: iOS
- [X] :robot: Android
- [ ] :checkered_flag: WPF
- [ ] :earth_americas: UWP
- [ ] :apple: MacOS
- [ ] :tv: tvOS
- [X] :monkey: Xamarin.Forms

Contributor guide

Open the contributing guide

Research direction

Reproduce the Android playback failure using the sample files and the formats listed in the issue, starting from the Play(files) call and the MediaItemFailed event. Compare which formats fail consistently and determine whether the expected result is support for those formats or a documented platform limitation; done means the behavior is verified and the supported formats are clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.