open_video()
  • 1 Minute to read

open_video()


Article summary

This function creates a component that is used to display iframe with title.

The video component provides a window that will play url of a video, it allows the user to play, pause or skip the video.

Reference

image.png

Explore more about this component here

Arguments

ArgumentsTypeDefault ValueDescription
urlAny (str)provided valid URL, usually in string format (mandatory)
close_after_finishedboolFalseSends an action when the video is finished
titlestringTitle of the screen (mandatory)
title_sizeenumUI_TITLE_SIZE.MEDIUMSize of the title
show_back_buttonboolFalseShow a button to go back
back_button_textstring"Back"Text of the back button
button_sizeint1Button size (1 = SMALL, 2 = MEDIUM, 3 = LARGE)
widthstr'85%'Relative width of the video window
heightstr'75%'Relative height of the video window
languageslistNoneList of languages to be displayed on the screen (optional)
chosen_languagestrNoneIf list given, string representing chosen language
themeenumUI_THEME_TYPE.DARKEnum to define the theme of the screen, check UI_THEME_TYPE
custom_styledictNoneDictionary containing custom styles for the modal (optional)
waitboolTrueBool indicating to wait for user response (optional)
callbackcallableNoneCallable function to handle the response (optional)

See the complete list of general enumerations.

Return

Dictionary that contains the action performed by the component or the user
Ex: {'action': 'video_ended', 'app_id': 'doctest'}

Exception

  • RayaUIMissingValue
  • RayaNeedCallback

See the complete list of ui exceptions and the complete list of general exceptions.

Callback Arguments

callback

ArgumentTypeDescription
datadictDict containing the result of the action

Example

...


class RayaApplication(RayaApplicationBase):

    async def setup(self):
        self.UI = await self.enable_controller('ui')
        ....
        
    async def loop(self):
     ....
        await self.UI.open_link(
            title="Video Title", 
            url = "https://www.youtube.com/watch?v=OFY-_saNaqs"
        )
      ...
      
    async def finish(self):
      ...

...

Was this article helpful?