cms/apps/media/models.py
def embed_html(self, loop=False, autoplay=False, controls=False, mute=False, youtube_parameters=None):
        '''
        Returns the HTML code for embedding the video.
        Expects youtube_parameters as a dictionary in the form {parameter:value}
        When using, this is a function so call with {{ video.embed_html|safe }}
        '''
        if self.external_video:
            if self.external_video_service == 'youtube':
                return render_to_string('videos/youtube.html', {
                    'src': self.external_video_iframe_url,
                    'autoplay': int(autoplay),
                    'controls': int(controls),
                    'loop': int(loop),
                    'muted': int(mute),
                    'extra_parameters': ('&amp;' + '&amp;'.join('{}={}'.format(parameter, youtube_parameters[parameter]) for parameter in youtube_parameters)) if youtube_parameters else '',
                    'schema': self.get_schema(),
                })
            elif self.external_video_service == 'vimeo':
                return render_to_string('videos/vimeo.html', {
                    'src': self.external_video_iframe_url,
                    'autoplay': int(autoplay),
                    'controls': int(not controls),
                    'loop': int(loop),
                    'muted': int(mute),
                    'schema': self.get_schema(),
                })
            return render_to_string('videos/default.html', {
                'src': self.external_video_iframe_url,
            })
        if self.high_resolution_mp4 or self.low_resolution_mp4:
            return render_to_string('videos/local.html', {
                'preload': 'auto' if autoplay else 'metadata',
                'autoplay': ' autoplay' if autoplay else '',
                'controls': ' controls' if controls else '',
                'loop': ' loop' if loop else '',
                'muted': ' muted' if mute else '',
                'high_resolution_file': self.high_resolution_mp4.file.url if self.high_resolution_mp4 else None,
                'high_resolution_filetype': self.high_resolution_mp4.file.url.split('.')[-1] if self.high_resolution_mp4 else None,
                'low_resolution_file': self.low_resolution_mp4.file.url if self.low_resolution_mp4 else None,
                'low_resolution_filetype': self.low_resolution_mp4.file.url.split('.')[-1] if self.low_resolution_mp4 else None,
                'image': self.image,
                'schema': self.get_schema(),
            })

        Returns the HTML code for embedding the video.
        Expects youtube_parameters as a dictionary in the form {parameter:value}
        When using, this is a function so call with {{ video.embed_html|safe }}
        
Returns the HTML code for embedding the video.
Expects youtube_parameters as a dictionary in the form {parameter:value}
When using, this is a function so call with {{ video.embed_html|safe }}
Returns the HTML code for embedding the video . Expects youtube_parameters as a dictionary in the form { parameter : value } When using this is a function so call with {{ video . embed_html|safe }}
def embed_html(self, loop=False, autoplay=False, controls=False, mute=False, youtube_parameters=None):
        if self.external_video:
            if self.external_video_service == 'youtube':
                return render_to_string('videos/youtube.html', {
                    'src': self.external_video_iframe_url,
                    'autoplay': int(autoplay),
                    'controls': int(controls),
                    'loop': int(loop),
                    'muted': int(mute),
                    'extra_parameters': ('&amp;' + '&amp;'.join('{}={}'.format(parameter, youtube_parameters[parameter]) for parameter in youtube_parameters)) if youtube_parameters else '',
                    'schema': self.get_schema(),
                })
            elif self.external_video_service == 'vimeo':
                return render_to_string('videos/vimeo.html', {
                    'src': self.external_video_iframe_url,
                    'autoplay': int(autoplay),
                    'controls': int(not controls),
                    'loop': int(loop),
                    'muted': int(mute),
                    'schema': self.get_schema(),
                })
            return render_to_string('videos/default.html', {
                'src': self.external_video_iframe_url,
            })
        if self.high_resolution_mp4 or self.low_resolution_mp4:
            return render_to_string('videos/local.html', {
                'preload': 'auto' if autoplay else 'metadata',
                'autoplay': ' autoplay' if autoplay else '',
                'controls': ' controls' if controls else '',
                'loop': ' loop' if loop else '',
                'muted': ' muted' if mute else '',
                'high_resolution_file': self.high_resolution_mp4.file.url if self.high_resolution_mp4 else None,
                'high_resolution_filetype': self.high_resolution_mp4.file.url.split('.')[-1] if self.high_resolution_mp4 else None,
                'low_resolution_file': self.low_resolution_mp4.file.url if self.low_resolution_mp4 else None,
                'low_resolution_filetype': self.low_resolution_mp4.file.url.split('.')[-1] if self.low_resolution_mp4 else None,
                'image': self.image,
                'schema': self.get_schema(),
            })
def embed_html ( self , loop = False , autoplay = False , controls = False , mute = False , youtube_parameters = None ) : if self . external_video : if self . external_video_service == 'youtube' : return render_to_string ( 'videos/youtube.html' , { 'src' : self . external_video_iframe_url , 'autoplay' : int ( autoplay ) , 'controls' : int ( controls ) , 'loop' : int ( loop ) , 'muted' : int ( mute ) , 'extra_parameters' : ( '&amp;' + '&amp;' . join ( '{}={}' . format ( parameter , youtube_parameters [ parameter ] ) for parameter in youtube_parameters ) ) if youtube_parameters else '' , 'schema' : self . get_schema ( ) , } ) elif self . external_video_service == 'vimeo' : return render_to_string ( 'videos/vimeo.html' , { 'src' : self . external_video_iframe_url , 'autoplay' : int ( autoplay ) , 'controls' : int ( not controls ) , 'loop' : int ( loop ) , 'muted' : int ( mute ) , 'schema' : self . get_schema ( ) , } ) return render_to_string ( 'videos/default.html' , { 'src' : self . external_video_iframe_url , } ) if self . high_resolution_mp4 or self . low_resolution_mp4 : return render_to_string ( 'videos/local.html' , { 'preload' : 'auto' if autoplay else 'metadata' , 'autoplay' : ' autoplay' if autoplay else '' , 'controls' : ' controls' if controls else '' , 'loop' : ' loop' if loop else '' , 'muted' : ' muted' if mute else '' , 'high_resolution_file' : self . high_resolution_mp4 . file . url if self . high_resolution_mp4 else None , 'high_resolution_filetype' : self . high_resolution_mp4 . file . url . split ( '.' ) [ - 1 ] if self . high_resolution_mp4 else None , 'low_resolution_file' : self . low_resolution_mp4 . file . url if self . low_resolution_mp4 else None , 'low_resolution_filetype' : self . low_resolution_mp4 . file . url . split ( '.' ) [ - 1 ] if self . low_resolution_mp4 else None , 'image' : self . image , 'schema' : self . get_schema ( ) , } )
Returns the HTML code for embedding the video.
Returns the HTML code for embedding the video .
'''
        Returns the HTML code for embedding the video.
        Expects youtube_parameters as a dictionary in the form {parameter:value}
        When using, this is a function so call with {{ video.embed_html|safe }}
        '''
self
loop
autoplay
controls
mute
youtube_parameters