Skip to content

Commit

Permalink
feat: add playsinline parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
12rambau committed Nov 5, 2024
1 parent 60ec268 commit 17b6361
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,27 @@ the video directive supports all the optional attributes from the html tag as su
``:preload:``,``str``,"Specifies if and how the author thinks the video should be loaded when the page loads. Can only be values from ``['auto', 'metadata', 'none']``"
``:width:``,``int``, Sets the width of the video player in pixels
``:class:``,``str``, Set extra class to the video html tag
``:playsinline:``,,Specifies that the video will play in-line (instead of full-screen) on small devices.

They can be used as any directive option:

.. code-block:: rst
.. video:: _static/video.mp4
:nocontrols:
:autoplay:
:playsinline:
:muted:
:loop:
:poster: _static/image.png
.. video:: _static/video.mp4
:nocontrols:
:autoplay:
:playsinline:
:muted:
:loop:
:poster: _static/image.png

And using the ``:class:`` parameter in combination with custom css, you can change the display of the html ``<video>`` tag:

Expand Down
2 changes: 2 additions & 0 deletions sphinxcontrib/video/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class Video(SphinxDirective):
"preload": directives.unchanged,
"width": directives.unchanged,
"class": directives.unchanged,
"playsinline": directives.flag,
}

def run(self) -> List[video_node]:
Expand Down Expand Up @@ -150,6 +151,7 @@ def run(self) -> List[video_node]:
preload=preload,
width=width,
klass=self.options.get("class", ""),
playsinline="playsinline" in self.options,
)
]

Expand Down

0 comments on commit 17b6361

Please sign in to comment.