Comments (7)
Yep, the code should be like that (exept the indentation), because the play
method only starts the playback (it spawns an internal mpv command, to be exact) and return. Now the your script will run the next line, if there is any, or quit. Since the mpv instance is a children thread of the script, it also gets closed. wait_for_playback
pends until the playback is done so that you can watch the video.
Documentation, as usual, can be accessed via python3 -c "import mpv; help(mpv)"
.
from python-mpv.
The problem isn't in macOS-compatiblity of python-mpv, but in your code. mpv.MPV.play
only tell the player to play, but the script ends so the mpv instance get closed too. You'll need to add player.wait_for_playback
to the end of the script to, eh, make it wait for playback before quiting.
from python-mpv.
emmmmm... sorry, I don't really understand what you mean. you mean the script run so fast, and I need to send a signal to it? code like this?
player = mpv.MPV(ytdl=True)
url = 'https://www.bilibili.com/video/av16942715/'
player.play(url)
player.wait_for_playback()
or you have any other more detailed documents? thx
from python-mpv.
emmm...indentation is my fault. I run my script, but no any responses. I mean the script run for a long time without any responses in my terminal. And also no video is playing, is this normal?
from python-mpv.
Did you put import mpv
at the begin of the script? Does mpv https://www.bilibili.com/video/av16942715/
work? Could you please post infomation on the version of youtube-dl
, Python 3 and mpv
?
from python-mpv.
Since this and #61 really look like duplicates, I'm closing this now. If you have any further questions, feel free to re-open it.
Try the potential PyQT workaround in #61 and over there tell us whether it works. I don't have an Apple machine so I can't debug this on my own.
from python-mpv.
Oh, and one more hint, though that is not likely to be the problem: youtube-dl sometimes does take a really long time. For testing better try a small, local file such as https://raw.githubusercontent.com/jaseg/python-mpv/master/test.webm .
from python-mpv.
Related Issues (20)
- Player not opening in MacOS HOT 2
- pause and resume playback HOT 1
- where can i get libmpv? HOT 1
- "Cannot Find libmpv in the usual places"(OSX) HOT 2
- in Line 1189 Error HOT 1
- ctypes.util.find_library() Fails to find Windows libmpv-2.dll HOT 1
- Cannot load mpv.config (Windows) HOT 5
- macOS: libmpv cannot get a VO. HOT 11
- Gapless playback not always working HOT 2
- python-mpv not finding libmpv DLL on MSYS2 HOT 7
- no-border not working as intended HOT 1
- tests/test_mpv.py::TestLifecycle::test_wait_for_event_shutdown hangs HOT 1
- Audio controls
- I do not literally know which DLLs does it need to consume HOT 2
- How to directly play audio bytes? HOT 2
- "Cannot find libmpv in the usual places" on Arch Linux, Hypnotix HOT 2
- How to replace mpv.MpvEventID.METADATA_UPDATE ? HOT 2
- Loadfile command broken by API change in mpv v0.38.0 HOT 5
- The PyPI package is not up to date HOT 3
- playlist_next() and playlist_prev() beyond end of playlist causes SystemError HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-mpv.