I need a function to play a video inside a window of tkinter, given only the url of the video. Moreover the video can be of any streaming platform. The only solution that i found is to use an external web pace to load the page with the video, but this isn’t my target
Read above. Thanks in advance for the answer.
2
Answers
Your stated goal is infeasible.
Tkinter doesn’t evaluate javascript.
Many of those streaming platforms rely on JS
for proper selection and playback of video,
and to manipulate the DOM.
You will want something like a browser
if you intend to interact with such platforms.
There are point solutions for a handful of
bigger platforms, such as YouTube,
that may work well in a tkinter widget.
It is feasible for tkinter to send commands
to Selenium, which in turn can control a browser.
Consider focusing just on "playback of *.mp4 streams"
within a tkinter app.
The MPEG content could come from a local downloaded file
or from TCP connection to an internet webserver.
Description:
You can easily play a video using an online url using the Python tkVideoPlayer library. Keep in mind that the url you are using should contain the address to the file itself with its format.
Usage:
If you are using Tkinter:
If you are using customtkiner:
Note:
The package tkVideoPlayer isn’t installing properly and hence giving an error I would suggest you to import it locally and then use it.
Proof:
Video running on Tkinter:
Video running on customtkinter: