davidbritch / dotnet-maui-videoplayer Goto Github PK
View Code? Open in Web Editor NEWA video player implementation for .NET MAUI
License: MIT License
A video player implementation for .NET MAUI
License: MIT License
Android works great, but when I run via Windows I get this exception:
protected override FrameworkElement CreatePlatformView() => throw new PlatformNotSupportedException("No MediaElement control on Windows.");
Hello:
I am new to .NET MAUI, and I found your repo, it looks good.
But I have a question, I want to know if I can use some WinForm GUI toolbox control, like checkListBox or similar item in MAUI, so I can pick up or mark specific video from a list of videos.
For example: I have a total 10 videos in one folder: [D:\Videos], their names like:
1.mp4, 2.mp4, 3.mp4, 4.mp4, 5.mp4, 6.mp4, 7.mp4, 8.mp4, 9.mp4 and 10.mp4.
I want to be able to play those video one after another, like: play 1.mp4 first, 2.mp4 second, etc… until play 10.mp4 last.
For VLC media player, you can open a folder, so the media player will play all the videos inside that folder, you don’t have to manually play next one, after the current video playing is finished.
First, I want to know if I can write some code, just like VLC media player, so I can play all the videos inside one folder, so I don’t have to manually play next one?
If yes, please show me some code or some idea on how to do this.
Second, as I have multiple videos from different sources, but some of them are duplicate, for example, inside those 10 videos, I found 1.mp4 and 10.mp4 are actually the same video, therefore, I want to have some kind of mark to indication that they are duplicate, then later on, I can use C# code to delete all the duplicates, and keep only the first one?
If I can have some WinForm app toolbox control, like checkListBox, and indicate each video name in the all play list, then later on, I can use C# code to select all those items inside checkListBox, and delete all the duplicates and keep only the first video.
Since I don’t know much about .NET MAUI, I want to know what kind of controls can be used in .NET MAUI to work like checkListBox in Winform project.
Please advise,
Thanks,
I tried your code on our project and custom slider not works on Android(works on windows) even in your own sample :((((( is there any workarounds for that?!
Btw, Thanks for your amazing sample you saved my day!
I have noticed that the Controls on Android fades away after few seconds unless you tap on the Video whereas on iOS/Mac there's a fixed Play button at the centre of the Video with a thumbnail behind it.
Could there be a way to have either thumbnails for each Video or perhaps have Controls fixed without fading away as the end-user might think that there's no Video to play.
First of all, thanks for doing this, great project. It is amazing that MS didn't implement Video player themselves.
I'm trying to implement your example into my project.
I have mp4 file that I used in your example to try to play it as a resource file in Raw folder, it works.
I have added all the file in my project
When I try to play the file in my project, it displays dialog with message: "Can't play this video".
From output I'm getting:
[VideoView] Unable to open content: content://com.mobileapp/splashvideo.mp4
[VideoView] java.io.IOException: setDataSource failed.: status=0x80000000
[VideoView] at android.media.MediaPlayer.nativeSetDataSource(Native Method)
[VideoView] at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1260)
[VideoView] at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1247)
[VideoView] at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1158)
[VideoView] at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1179)
[VideoView] at android.widget.VideoView.openVideo(VideoView.java:412)
[VideoView] at android.widget.VideoView.access$2200(VideoView.java:83)
[VideoView] at android.widget.VideoView$7.surfaceCreated(VideoView.java:694)
[VideoView] at android.view.SurfaceView.updateSurface(SurfaceView.java:1350)
[VideoView] at android.view.SurfaceView.lambda$new$1$SurfaceView(SurfaceView.java:254)
[VideoView] at android.view.SurfaceView$$ExternalSyntheticLambda2.onPreDraw(Unknown Source:2)
[VideoView] at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1112)
[VideoView] at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4171)
[VideoView] at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2893)
[VideoView] at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:10445)
[VideoView] at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1108)
[VideoView] at android.view.Choreographer.doCallbacks(Choreographer.java:866)
[VideoView] at android.view.Choreographer.doFrame(Choreographer.java:797)
[VideoView] at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1092)
[VideoView] at android.os.Handler.handleCallback(Handler.java:938)
[VideoView] at android.os.Handler.dispatchMessage(Handler.java:99)
[VideoView] at android.os.Looper.loopOnce(Looper.java:226)
[VideoView] at android.os.Looper.loop(Looper.java:313)
[VideoView] at android.app.ActivityThread.main(ActivityThread.java:8663)
[VideoView] at java.lang.reflect.Method.invoke(Native Method)
[VideoView] at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
[VideoView] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
[VideoView] Error: 1,0
Do you have any idea what could've gone wrong?
Thanks
Just a question. Is it expected that Chromecast will be possible with this one?
I tried pack it into a nuget package but it has some error, so I wonder when we will be able to see a nuget package.
Hello
I followed the previous issue regarding this error on Android however, mine is a little bit different in that the videos (.mp4 & .mov) were playing just fine when they were hosted along side my .Net Core MVC application.
I moved those videos to Azure Blob Storage without changing anything such as file names etc and yet the error pops up on Android and yet all the videos are loaded just fine on iOS and can play them.
Here is the strange thing, today I cloned this application and ran it just to confirm that it is working as expected on both iOS simulator and Android emulator and all was good. I changed the source of the Video to one of the Videos currently on Azure but it failed even on this project.
I can provide the links to those videos if anyone is willing to reproduce the issue with Android.
Good code guy !
Is it possible to have the video fullscreen when device orientation is landscape?
So I'm having an issue with my project that I'm not sure how to solve. (I'm new to .net Maui)
I ported the code into my project, but I'm getting this error on my VideoHandler.MaciOS file:
The type or namespace name 'MauiVideoPlayer' could not be found (are you missing a using directive or an assembly reference?)
I'm missing something from your project, but I can't figure out what it is.
I added the following to my project file and it seems to work for all but the MaciOS files.
On your project it seems to default to "net7.0-maccatalyst", but on mine it defaults to "net7.0-iOS" for the VideoHandler.MaciOS.cs file, which is why I'm getting the error I think.
<ItemGroup Condition="$(TargetFramework.StartsWith('net7.0-android')) != true">
<Compile Remove="**\**\*.Android.cs" />
<None Include="**\**\*.Android.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net7.0-ios')) != true AND $(TargetFramework.StartsWith('net7.0-maccatalyst')) != true">
<Compile Remove="**\**\*.MaciOS.cs" />
<None Include="**\**\*.MaciOS.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-windows')) != true ">
<Compile Remove="**\*.Windows.cs" />
<None Include="**\*.Windows.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.