def movie(self,
              filename,                 # the video file to play (preferably a relative path)
              block=False,              # optionally wait until the movie has finished playing before returning from this function 
              # optional parameters:
              pos=None,                 # the (x,z) or (x,y,z) position of the video on the screen; this may be a 3-tuple of floats; y should be zero
              hpr=None,                 # the (heading,pitch,roll) angles of the video; if this is a single number, it will be taken as the roll angle
              scale=None,               # scaling of the video area; this may be a single float, an (x,z) value, or an (x,y,z) value; note that one of 
                                        # the scale axes is shrunken according to the value of the "aspect" property (which is auto-deduced unless manually overridden)
              color=None,               # the (r,g,b,a) coloring of the video
              parent=None,              # parent rendering context or Panda3d NodePath
              volume=0.1,               # the volume of the sound (between 0 and 1)
              direction=0.0,            # the balance; may be a number between -1 (hard left) and 1 (hard right)
              timeoffset=0.0,           # time offset into the file
              playrate=1.0,             # the playback rate of the movie (changes pitch & duration)
              looping=False,            # whether the video should be looping; can be turned off by calling .stop() on the return value of this function 
              loopcount=None,           # optionally the number of repeats if looping
              aspect=None,              # aspect ratio of the video (auto-deduced if None); example: for 16:9 this would be 16.0/9.0 
                                        # the smaller axis of the video area is automatically shrunken based on this number
              pixelscale=False,         # if this is True, aspect will be ignored and the image will be scaled according to the pixels in the image
                                        # for this you need to pass as parent a randerer that uses a pixel coordinate system (such as pixel2d)
              contentoffset=(0,0),      # [u,v] offset of the movie content within the viewport/texture
              contentscale=None,        # [u,v] scale of the movie content within the viewport/texture -- if None this is automatically deduced based on the
                                        # texture size and the size of the video content within the texture (note that it can be tricky to get this right due  
                                        # to possible padding introduced when the movie is loaded)
              bordercolor=(0,0,0,0),    # the border color of the movie texture (only visible when the contentoffset and contentscale are used
              ):
        """Play a movie. Note: Sound for movies only works with OpenAL (rather than FMOD) -- see documentation at http://www.panda3d.org/manual/index.php/Sound on how to select it."""

        # load the sound track if there is one
        try:
            snd = self._engine.base.loader.loadSfx(filename)
            if snd.length() == 0.0:
                snd = None
        except:
            snd = None
        # ... and set basic sound properties
        if snd is not None:
            self._to_destroy.append(snd)
            snd.setVolume(volume)
            snd.setBalance(direction)

        # create the video texture and set basic properties
        tex = self._engine.base.loader.loadTexture(filename)
        self._to_destroy.append(tex)
        tex.setBorderColor((bordercolor[0],bordercolor[1],bordercolor[2],bordercolor[3]))
        tex.setWrapU(self._engine.pandac.Texture.WMBorderColor)
        tex.setWrapV(self._engine.pandac.Texture.WMBorderColor)
        if snd is not None:
            tex.synchronizeTo(snd)

        # apply custom playback options and deduce the actual length
        if snd is not None:
            length = snd.length()
            playable = snd
        else:
            length = tex.getTime()
            playable = tex
        if playrate != 1.0:
            playable.setPlayRate(playrate)
            length /= playrate
        if loopcount is not None:
            playable.setLoopCount(loopcount)
            length = length*loopcount
        playable.setLoop(looping)
        if looping:
            length = 10000000
        if timeoffset > 0.0:
            playable.setTime(timeoffset)
            length -= timeoffset

        # deduce the aspect ratio
        if aspect is None:
           aspect = tex.getVideoWidth() / float(tex.getVideoHeight())
        # deduce the content scale based on the padding in the video        
        if contentscale is None:
            contentscale = (float(tex.getVideoWidth()) / tex.getXSize(), float(tex.getVideoHeight()) / tex.getYSize())
        # deduce the scale of the image
        if scale is None:
            scale = 1.0
        if type(scale) in (int,float):
            scale = [scale,scale]
        if len(scale) == 2:
            scale = (scale[0],1,scale[1])
        if pixelscale or parent == pixel2d:
            scale[0] *= tex.getVideoWidth()
            scale[2] *= tex.getVideoHeight()
        else:
            if aspect >= 1.0:
                scale[2] /= float(aspect)
            else:
                scale[0] *= float(aspect)
            
        # deduce position and rotation
        if pos is not None and type(pos) not in (int,float) and len(pos) == 2:
            pos = (pos[0],0,pos[1])
        if hpr is not None and type(scale) not in (int,float) and len(hpr) == 1:
            hpr = (0,0,hpr)
        
        # create the image and set up content parameters
        img = self._engine.direct.gui.OnscreenImage.OnscreenImage(image=tex,pos=pos,hpr=hpr,scale=scale,color=color,parent=parent)
        self._to_destroy.append(img)
        img.setTransparency(self._engine.pandac.TransparencyAttrib.MAlpha)
        img.setTexScale(self._engine.pandac.TextureStage.getDefault(),contentscale[0],contentscale[1])
        img.setTexOffset(self._engine.pandac.TextureStage.getDefault(),contentoffset[0],contentoffset[1])

        # start playback and assure its destruction
        playable.play()
        if self.implicit_markers:
            self.marker(244)            
        if block:
            self.sleep(length)
            self._destroy_object(img, 245)
        else:
            self._engine.base.taskMgr.doMethodLater(length, self._destroy_object, 'ConvenienceFunctions, remove_movie', extraArgs=[[img,tex,snd],245])
            return playable
dataset/ETHPy150Open sccn/SNAP/src/framework/basicstimuli.py/BasicStimuli.movie/original