Quantcast
Channel: Xamarin.Mac — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 1429

An example of using MPV to Play video on macOS

$
0
0

MPVDemo-macOS

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

You should find all the reference links from github.com/kevinzhow/MPVDemo-macOS since I can not post Links.

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 my project 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

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:
c# [DllImport("libmpv.1.25.0.dylib", EntryPoint = "mpv_create")] private static extern IntPtr MpvCreate();


Viewing all articles
Browse latest Browse all 1429

Trending Articles