Skip to content

Xamarin macOS Project to example how to use MPV to play video.

Notifications You must be signed in to change notification settings

kevinzhow/MPVDemo-macOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MPVDemo-macOS

This is a Xamarin macOS Project to example how to Use MPV to play video.

Basic flow

  1. Finding MPV dylibs
  2. Using DllImport to bind dylibs
  3. Play video

Finding MPV Dylibs

The most easiest way is grabbing it from Here and all these libs were modified from IINA project.

IINA's original dylibs were using @rpath to solve the Search Path which will cause System.DllNotFoundException.

You can fix it by install_name_tool thanks to brendanzagaeski.

Quick Example:

otool -L libavfilter.6.dylib

install_name_tool -change @rpath/libavutil.55.dylib  @loader_path/libavutil.55.dylib  libavfilter.6.dylib

DllImport

DllImport is C# way to do dlopen.

You can find the instruction from Xamarin Website.

Quick Example:

[DllImport("libmpv.1.25.0.dylib", EntryPoint = "mpv_create")]
private static extern IntPtr MpvCreate();

Play

MPV has made a great example of how to interaction mpv with C# at mpv-exmaples and mpvnet.

Cocoa platform's specific can also be found at cocoa-example

var windowId = VideoView.Handle.ToInt64();

MpvInitialize(_mpvHandle);

DoMpvCommand("loadfile", _mediaFilePath);

Play();

Resource

Property List List of Input Commands

About

Xamarin macOS Project to example how to use MPV to play video.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages