Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/valderman/haskell-mpv
Thread-safe Haskell wrapper around libmpv
https://github.com/valderman/haskell-mpv
haskell haskell-library libmpv library media-playback
Last synced: about 2 hours ago
JSON representation
Thread-safe Haskell wrapper around libmpv
- Host: GitHub
- URL: https://github.com/valderman/haskell-mpv
- Owner: valderman
- License: isc
- Created: 2019-07-08T18:45:50.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-07-09T20:05:46.000Z (over 5 years ago)
- Last Synced: 2024-11-30T20:44:30.578Z (about 2 months ago)
- Topics: haskell, haskell-library, libmpv, library, media-playback
- Language: Haskell
- Size: 13.7 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
haskell-mpv
===========A thread-safe, mid-level Haskell wrapper around [libmpv](https://mpv.io/).
Usage
-----A very spartan media player in 18 lines, using `Codec.MPV.Simple`:
```haskell
module Main where
import Codec.MPV.Simple
import Control.Concurrent (MVar, newEmptyMVar, putMVar, takeMVar)
import System.Environment (getArgs)main :: IO ()
main = do
files <- getArgs
fileDone <- newEmptyMVar
mpv <- simpleMPV simpleSettings { eventHandler = handleEOF fileDone }
mapM_ (playFile mpv fileDone) fileshandleEOF :: MVar () -> MPV -> MPVEvent -> IO ()
handleEOF fileDone mpv (EndFileEvent _) = putMVar fileDone ()
handleEOF fileDone mpv _ = return ()playFile :: MPV -> MVar () -> FilePath -> IO ()
playFile mpv fileDone file = loadFile mpv file >> takeMVar fileDone
```For more control over rendering, window management, and the MPV event loop,
use `Codec.MPV` instead.Troubleshooting
---------------### I don't get any video output!
* Did you create an OpenGL rendering context and set it as the current context
(`glMakeCurrent`)?
* Are you calling `renderFrame` in response to `RenderEvent`s?
* Are you properly presenting your rendering buffer after calling `renderFrame`
(`glSwapBuffers`)?