Video Output Types#
This module defines the rich output types for video formats.
- class sage.repl.rich_output.output_video.OutputVideoAvi(video, loop=True)[source]#
Bases:
OutputVideoBase
AVI video
EXAMPLES:
sage: from sage.repl.rich_output.output_catalog import OutputVideoAvi sage: OutputVideoAvi.example() OutputVideoAvi container
>>> from sage.all import * >>> from sage.repl.rich_output.output_catalog import OutputVideoAvi >>> OutputVideoAvi.example() OutputVideoAvi container
- ext = '.avi'#
- mimetype = 'video/x-msvideo'#
- class sage.repl.rich_output.output_video.OutputVideoBase(video, loop=True)[source]#
Bases:
OutputBase
Abstract base class for rich video output
INPUT:
video
–OutputBuffer
. The video data.loop
– boolean. Whether to repeat the video in an endless loop.
EXAMPLES:
sage: from sage.repl.rich_output.output_catalog import OutputVideoOgg sage: OutputVideoOgg.example() # indirect doctest OutputVideoOgg container
>>> from sage.all import * >>> from sage.repl.rich_output.output_catalog import OutputVideoOgg >>> OutputVideoOgg.example() # indirect doctest OutputVideoOgg container
- classmethod example()[source]#
Construct a sample video output container
This static method is meant for doctests, so they can easily construct an example. The method is implemented in the abstract
OutputVideoBase
class, but should get invoked on a concrete subclass for which an actual example can exist.OUTPUT:
An instance of the class on which this method is called.
EXAMPLES:
sage: from sage.repl.rich_output.output_catalog import OutputVideoOgg sage: OutputVideoOgg.example() OutputVideoOgg container sage: OutputVideoOgg.example().video buffer containing 5612 bytes sage: OutputVideoOgg.example().ext '.ogv' sage: OutputVideoOgg.example().mimetype 'video/ogg'
>>> from sage.all import * >>> from sage.repl.rich_output.output_catalog import OutputVideoOgg >>> OutputVideoOgg.example() OutputVideoOgg container >>> OutputVideoOgg.example().video buffer containing 5612 bytes >>> OutputVideoOgg.example().ext '.ogv' >>> OutputVideoOgg.example().mimetype 'video/ogg'
- html_fragment(url, link_attrs='')[source]#
Construct a HTML fragment for embedding this video
INPUT:
url
– string. The URL where the data of this video can be found.link_attrs
– string. Can be used to style the fallback link which is presented to the user if the video is not supported.
EXAMPLES:
sage: from sage.repl.rich_output.output_catalog import OutputVideoOgg sage: print(OutputVideoOgg.example().html_fragment ....: ('foo', 'class="bar"').replace('><','>\n<')) <video autoplay="autoplay" controls="controls" loop="loop"> <source src="foo" type="video/ogg" /> <p> <a target="_new" href="foo" class="bar">Download video/ogg video</a> </p> </video>
>>> from sage.all import * >>> from sage.repl.rich_output.output_catalog import OutputVideoOgg >>> print(OutputVideoOgg.example().html_fragment ... ('foo', 'class="bar"').replace('><','>\n<')) <video autoplay="autoplay" controls="controls" loop="loop"> <source src="foo" type="video/ogg" /> <p> <a target="_new" href="foo" class="bar">Download video/ogg video</a> </p> </video>
- class sage.repl.rich_output.output_video.OutputVideoFlash(video, loop=True)[source]#
Bases:
OutputVideoBase
Flash video
EXAMPLES:
sage: from sage.repl.rich_output.output_catalog import OutputVideoFlash sage: OutputVideoFlash.example() OutputVideoFlash container
>>> from sage.all import * >>> from sage.repl.rich_output.output_catalog import OutputVideoFlash >>> OutputVideoFlash.example() OutputVideoFlash container
- ext = '.flv'#
- mimetype = 'video/x-flv'#
- class sage.repl.rich_output.output_video.OutputVideoMatroska(video, loop=True)[source]#
Bases:
OutputVideoBase
Matroska Video
EXAMPLES:
sage: from sage.repl.rich_output.output_catalog import OutputVideoMatroska sage: OutputVideoMatroska.example() OutputVideoMatroska container
>>> from sage.all import * >>> from sage.repl.rich_output.output_catalog import OutputVideoMatroska >>> OutputVideoMatroska.example() OutputVideoMatroska container
- ext = '.mkv'#
- mimetype = 'video/x-matroska'#
- class sage.repl.rich_output.output_video.OutputVideoMp4(video, loop=True)[source]#
Bases:
OutputVideoBase
MPEG 4 video
EXAMPLES:
sage: from sage.repl.rich_output.output_catalog import OutputVideoMp4 sage: OutputVideoMp4.example() OutputVideoMp4 container
>>> from sage.all import * >>> from sage.repl.rich_output.output_catalog import OutputVideoMp4 >>> OutputVideoMp4.example() OutputVideoMp4 container
- ext = '.mp4'#
- mimetype = 'video/mp4'#
- class sage.repl.rich_output.output_video.OutputVideoOgg(video, loop=True)[source]#
Bases:
OutputVideoBase
Ogg video, Ogg Theora in particular
EXAMPLES:
sage: from sage.repl.rich_output.output_catalog import OutputVideoOgg sage: OutputVideoOgg.example() OutputVideoOgg container
>>> from sage.all import * >>> from sage.repl.rich_output.output_catalog import OutputVideoOgg >>> OutputVideoOgg.example() OutputVideoOgg container
- ext = '.ogv'#
- mimetype = 'video/ogg'#
- class sage.repl.rich_output.output_video.OutputVideoQuicktime(video, loop=True)[source]#
Bases:
OutputVideoBase
Quicktime video
EXAMPLES:
sage: from sage.repl.rich_output.output_catalog import OutputVideoQuicktime sage: OutputVideoQuicktime.example() OutputVideoQuicktime container
>>> from sage.all import * >>> from sage.repl.rich_output.output_catalog import OutputVideoQuicktime >>> OutputVideoQuicktime.example() OutputVideoQuicktime container
- ext = '.mov'#
- mimetype = 'video/quicktime'#
- class sage.repl.rich_output.output_video.OutputVideoWebM(video, loop=True)[source]#
Bases:
OutputVideoBase
WebM video
The video can be encoded using VP8, VP9 or an even more recent codec.
EXAMPLES:
sage: from sage.repl.rich_output.output_catalog import OutputVideoWebM sage: OutputVideoWebM.example() OutputVideoWebM container
>>> from sage.all import * >>> from sage.repl.rich_output.output_catalog import OutputVideoWebM >>> OutputVideoWebM.example() OutputVideoWebM container
- ext = '.webm'#
- mimetype = 'video/webm'#
- class sage.repl.rich_output.output_video.OutputVideoWmv(video, loop=True)[source]#
Bases:
OutputVideoBase
Windows Media Video
EXAMPLES:
sage: from sage.repl.rich_output.output_catalog import OutputVideoWmv sage: OutputVideoWmv.example() OutputVideoWmv container
>>> from sage.all import * >>> from sage.repl.rich_output.output_catalog import OutputVideoWmv >>> OutputVideoWmv.example() OutputVideoWmv container
- ext = '.wmv'#
- mimetype = 'video/x-ms-wmv'#