VideoPuppeteer

video_puppeteer.VideoPuppeteer

class external_media_tests.media_utils.video_puppeteer.VideoPuppeteer(marionette, url, video_selector='video', interval=1, set_duration=0, stall_wait_time=0, timeout=60, autostart=True)[source]

Bases: object

Wrapper to control and introspect HTML5 video elements.

A note about properties like current_time and duration: These describe whatever stream is playing when the state is checked. It is possible that many different streams are dynamically spliced together, so the video stream that is currently playing might be the main video or it might be something else, like an ad, for example.

Parameters:
  • marionette – The marionette instance this runs in.
  • url – the URL of the page containing the video element.
  • video_selector – the selector of the element that we want to watch. This is set by default to ‘video’, which is what most sites use, but others should work.
  • interval – The polling interval that is used to check progress.
  • set_duration – When set to >0, the polling and checking will stop at the number of seconds specified. Otherwise, this will stop at the end of the video.
  • stall_wait_time – The amount of time to wait to see if a stall has cleared. If 0, do not check for stalls.
  • timeout – The amount of time to wait until the video starts.
get_debug_lines()[source]

Get Firefox internal debugging for the video element.

Returns:A text string that has Firefox-internal debugging information.
pause()[source]

Tell the video element to Pause.

play()[source]

Tell the video element to Play.

playback_done()[source]

If we are near the end and there is still a video element, then we are essentially done. If this happens to be last time we are polled before the video ends, we won’t get another chance.

Parameters:self – The VideoPuppeteer instance that we are interested in.
Returns:True if we are close enough to the end of playback; False otherwise.
playback_started()[source]

Determine if video has started

Parameters:self – The VideoPuppeteer instance that we are interested in.
Returns:True if is playing; False otherwise

video_puppeteer.VideoException

exception external_media_tests.media_utils.video_puppeteer.VideoException[source]

Exception class to use for video-specific error processing.

video_puppeteer.playback_started

video_puppeteer.playback_done