Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add playsinline parameter #48

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading