{"library":"python-vlc","title":"Python-VLC Bindings","description":"Python-VLC provides Python bindings for the VLC media player. It allows developers to integrate VLC's powerful multimedia capabilities, such as playing audio and video, streaming, and capturing, directly into Python applications. The current version, 3.0.21203, is generally kept in sync with major VLC releases, reflecting VLC 3.x features. While releases aren't on a strict cadence, updates typically follow significant VLC player developments.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install python-vlc"],"cli":null},"imports":["import vlc"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import vlc\nimport time\nimport os\n\n# NOTE: You MUST have VLC media player installed on your system.\n# For Windows: ensure VLC is installed and its directory (e.g., C:\\Program Files\\VideoLAN\\VLC) is in your PATH.\n# For Linux/macOS: VLC libraries are usually found automatically if installed via package manager.\n\n# Create a VLC instance\ninstance = vlc.Instance(['--no-xlib'])\n\n# Create a media player\nplayer = instance.media_player_new()\n\n# Path to a dummy video file for demonstration.\n# Replace 'path/to/your/video.mp4' with an actual video file on your system.\n# For testing, you can download a sample video or create a dummy file.\n# Example: 'file:///home/user/Videos/test.mp4' or 'C:\\Users\\User\\Videos\\test.mp4'\nmedia_file = os.environ.get('VLC_TEST_MEDIA_PATH', 'file:///path/to/your/video.mp4')\n\n# Create a media object from the file\nmedia = instance.media_new(media_file)\n\n# Set the media to the player\nplayer.set_media(media)\n\n# Play the media\nprint(f\"Attempting to play: {media_file}\")\nplayer.play()\n\n# Wait for a few seconds to allow playback (adjust as needed)\ntime.sleep(5) \n\n# Stop the player\nplayer.stop()\nprint(\"Playback stopped.\")\n","lang":"python","description":"Demonstrates initializing VLC, loading a media file, and playing it for a short duration. Remember to replace the placeholder media path with an actual file and ensure VLC media player is installed.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}