HTML playsinline Attribute

Beginner
6 min read
Updated: Nov 2026
3 examples
Live preview

Definition and Usage

The playsinline boolean attribute on <video> hints that the video should play in the page layout on mobile — especially important on iOS Safari, which historically entered fullscreen without it.

Combine with controls, muted, and autoplay when you need muted autoplay inline (common for hero loops).

Critical for iOS inline playback.

Without playsinline, many iOS versions force fullscreen when playback starts.

Autoplay still has rules.

Browsers often require muted (or user gesture) for autoplay even with playsinline.

HTML Syntax

syntax.html
<video playsinline >

Boolean attribute: presence means true. Empty value or the name alone both enable inline playback intent.

Attribute Values

ValueDescriptionTry it
(boolean)Present = prefer inline playback on mobileTry it

Live Preview

A sample video with playsinline and controls. Test on a phone for the real iOS difference.

Desktop may look the same; iOS Safari honors playsinline for in-page playback.

Result

playsinline present

HTML Examples

Example 1 — Video with playsinline

Mark the video so mobile browsers keep it in-page.

HTML
<video controls playsinline width="480">
  <source src="/video/count.mp4" type="video/mp4">
</video>
Try It Yourself

How It Works

  1. Add playsinline on the video element.
  2. Keep controls (or custom UI) for play/pause.
  3. Test on iOS Safari where the attribute matters most.
  4. Provide a source the browser can play.

Example 2 — Muted Autoplay Loop

Hero background videos usually need muted + playsinline + autoplay.

HTML
<video autoplay muted playsinline loop width="640">
  <source src="/video/count.mp4" type="video/mp4">
</video>
Try It Yourself

How It Works

  1. muted is usually required for autoplay.
  2. playsinline keeps playback in layout on iOS.
  3. loop for continuous hero motion.
  4. Offer a pause control for accessibility when possible.

Example 3 — Poster Before Play

Show a still frame until the user starts playback.

HTML
<video controls playsinline poster="/images/codetofun-logo.png" width="480">
  <source src="/video/count.mp4" type="video/mp4">
</video>
Try It Yourself

How It Works

  1. poster shows before the first frame.
  2. playsinline for in-page mobile play.
  3. controls for native UI.
  4. See the poster attribute for more detail.

Edge Cases & Pitfalls

playsinline is a hint — OS policies and autoplay rules still apply.

ios

iOS is the main reason

Desktop browsers already play inline; mobile Safari is the historical pain point.

autoplay

Muted for autoplay

playsinline alone does not bypass autoplay restrictions.

webkit

Legacy webkit-playsinline

Very old iOS used a prefixed attribute; modern Safari uses playsinline.

a11y

Motion sensitivity

Avoid forced looping motion without a way to pause.

Browser Support

playsinline is an HTML attribute for browsers. It is not a Node.js, Deno, or Bun API.

✓ Widely available

playsinline

Supported across modern mobile and desktop browsers; essential for iOS inline video.

95% Global support (approx.)
Google Chrome Yes
Full support
Mozilla Firefox Yes
Full support
Apple Safari Yes
Full support
Microsoft Edge Yes
Full support
Opera Yes
Full support
Samsung Internet Yes
Full support
Internet Explorer No support
Not supported
playsinline Widely supported

Bottom line: Always set playsinline on mobile-facing video players and muted autoplay heroes.

Key Takeaways

  • Role: prefer in-page video playback on mobile.
  • Element: video (boolean attribute).
  • Hero loops: autoplay + muted + playsinline.
  • Test on iOS where fullscreen was the default.

One line: playsinline keeps video in the page on mobile — especially iOS.

Frequently Asked Questions

It tells the browser to prefer playing the video inline in the page, especially on iOS where fullscreen was historically forced.
It matters most on iOS Safari, but it is valid HTML for video everywhere.
No. Autoplay still needs muted (or a user gesture) in most browsers.
Yes. Presence enables the intent; omit it when you do not want the hint.
Usually yes for user-started playback, unless you build custom controls.
That was a legacy prefixed form for older iOS. Use playsinline on modern sites.

Next: popover

Build top-layer overlays with the Popover API (auto, manual, hint).

popover tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful