-
You can stream videos directly on terminal with the functions
play_video()
andplay_youtube()
. -
The function
show()
is not necessary in both cases, as it is called internally. -
The frames size will adapt to the screen size, unless
plot_size()
is used before the steaming functions. -
To download videos from the given YouTube
url
to the specifiedpath
, use theget_youtube()
method. -
Both streaming functions may require further development. Any bug report or development idea is welcomed.
To play a video with audio, use the the play_video()
function. Set the parameter from_youtube
to True
to make sure that the color rendering is correct for videos downloaded from YouTube.
In this example, a test video is downloaded in the home folder, streamed and finally removed:
import plotext as plt
path = 'moonwalk.mp4'
plt.download(plt.test_video_url, path)
plt.play_video(path, from_youtube = True)
plt.delete_file(path)
or directly on terminal:
python3 -c "import plotext as plt; path = 'moonwalk.mp4'; plt.download(plt.test_video_url, path); plt.play_video(path, from_youtube = True); plt.delete_file(path)"
which will render this video on terminal. Yes! I am a Michael Jackson fan: he is number one (also innocent), not my fault!
More documentation can be accessed with doc.play_video()
.
To play a YouTube video from url
use the function play_youtube()
, as in this example:
import plotext as plt
plt.play_youtube(plt.test_youtube_url)
or directly on terminal:
python3 -c "import plotext as plt; plt.play_youtube(plt.test_youtube_url)"
which will render this youtube video on terminal.