Commit 5c1b9985 authored by Ahmed Hendawy's avatar Ahmed Hendawy
Browse files

Apply the live update feature to the URL property

parent 4f32b77c
......@@ -72,26 +72,29 @@ class YouTubePlayer:
A dictionary of the keys of the affected properties and their new values.
'''
self.url = self.get_property('URL')
self.framerate = self.get_property('FrameRate')
if 'FrameRate' in affected_properties:
self.framerate = self.get_property('FrameRate')
if 'URL' in affected_properties:
self.url = self.get_property('URL')
vPafy = pafy.new(self.url)
self.play = vPafy.getbest(preftype="mp4")
vPafy = pafy.new(self.url)
self.play = vPafy.getbest(preftype="mp4")
#start the video
self.play.download("/video.mp4")
self.cap = cv2.VideoCapture("/video.mp4")
while(self.cap.isOpened()== False):
#start the video
self.play.download("/video.mp4")
self.cap = cv2.VideoCapture("/video.mp4")
# Check if camera opened successfully
'''
To send an alert to the user of the block
(causes the block’s alerts icon to flicker and the alert message to be provided in the block’s Alerts tab),
use the following method given that alert_message can be any arbitrary string and
level is a string whose value is either INFO, WARN, or ERROR.
'''
self.alert("Error opening video stream or file",ERROR)
while(self.cap.isOpened()== False):
self.cap = cv2.VideoCapture("/video.mp4")
# Check if camera opened successfully
'''
To send an alert to the user of the block
(causes the block’s alerts icon to flicker and the alert message to be provided in the block’s Alerts tab),
use the following method given that alert_message can be any arbitrary string and
level is a string whose value is either INFO, WARN, or ERROR.
'''
self.alert("Error opening video stream or file",ERROR)
def on_stop(self):
# When everything done, release the video capture object
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment