All Projects → fregante → Iphone Inline Video

fregante / Iphone Inline Video

Licence: mit
📱 Make videos playable inline on the iPhone (prevents automatic fullscreen)

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to Iphone Inline Video

Ioctocat
iOctocat v1 - GitHub for iOS (works on the iPhone, iPad, and iPod Touch)
Stars: ✭ 1,665 (-17.57%)
Mutual labels:  iphone
Imagecapture Polyfill
MediaStream ImageCapture polyfill. Take photos from the browser as easy as .takePhoto().then(processPhoto)
Stars: ✭ 150 (-92.57%)
Mutual labels:  polyfill
Pulley
A library to imitate the iOS 10 Maps UI.
Stars: ✭ 1,928 (-4.55%)
Mutual labels:  iphone
Bender
Easily craft fast Neural Networks on iOS! Use TensorFlow models. Metal under the hood.
Stars: ✭ 1,728 (-14.46%)
Mutual labels:  iphone
Unwrap
Learn Swift interactively on your iPhone.
Stars: ✭ 1,992 (-1.39%)
Mutual labels:  iphone
Navigator.sendbeacon
Polyfill for Navigator.sendBeacon()
Stars: ✭ 151 (-92.52%)
Mutual labels:  polyfill
Appleapnpush
Send push notification to Apple Devices (iPhone, iPad)
Stars: ✭ 134 (-93.37%)
Mutual labels:  iphone
Clendar
Clendar - universal calendar app. Written in SwiftUI. Available on App Store
Stars: ✭ 153 (-92.43%)
Mutual labels:  iphone
Apple Device Model List
All Apple devices model name list. 通过内部编号判断 iOS 设备型号。
Stars: ✭ 149 (-92.62%)
Mutual labels:  iphone
Texture Compressor
CLI tool for texture compression using ASTC, ETC, PVRTC and S3TC in a KTX container.
Stars: ✭ 156 (-92.28%)
Mutual labels:  iphone
Cs193p Fall 2017
These are the lectures, slides, reading assignments, and problem sets for the Developing Apps for iOS 11 with Swift 4 CS193p course offered at the Stanford School of Engineering and available on iTunes U.
Stars: ✭ 141 (-93.02%)
Mutual labels:  iphone
Inappviewdebugger
A UIView debugger (like Reveal or Xcode) that can be embedded in an app for on-device view debugging
Stars: ✭ 1,805 (-10.64%)
Mutual labels:  iphone
Samsa
Variable font inspector
Stars: ✭ 153 (-92.43%)
Mutual labels:  polyfill
Mobile Web Favorites
This is a favorites, with a mobile web tips.
Stars: ✭ 1,724 (-14.65%)
Mutual labels:  iphone
Polyfill Php73
This component provides functions unavailable in releases prior to PHP 7.3.
Stars: ✭ 2,121 (+5%)
Mutual labels:  polyfill
History.js
History.js gracefully supports the HTML5 History/State APIs (pushState, replaceState, onPopState) in all browsers. Including continued support for data, titles, replaceState. Supports jQuery, MooTools and Prototype. For HTML5 browsers this means that you can modify the URL directly, without needing to use hashes anymore. For HTML4 browsers it wi…
Stars: ✭ 10,761 (+432.72%)
Mutual labels:  polyfill
Filesystem
FileSystem is an application that allows you to browse the content of your iPhone disk, displaying file and folders, files contents, and detailed informations about file and folder permissions.
Stars: ✭ 148 (-92.67%)
Mutual labels:  iphone
Unitysdk
Unity C# SDKs for PlayFab
Stars: ✭ 161 (-92.03%)
Mutual labels:  iphone
Raised Center Tab In Android
Customized tabhost having raised center tab.
Stars: ✭ 158 (-92.18%)
Mutual labels:  iphone
Ios Landing Page
Landing page template for iOS apps
Stars: ✭ 155 (-92.33%)
Mutual labels:  iphone

No longer needed 🎉

iOS now supports this natively since v10. So long, and thanks for all the videos!

iphone-inline-video

Make videos playable inline on Safari on iPhone (prevents automatic fullscreen)

gzipped size Travis build status npm version

This enables iOS 10's playsinline attribute on iOS 8 and iOS 9 (almost a polyfill). It lets you:

  • Play videos without going fullscreen on the iPhone (demo)
  • Play silent videos without user interaction
  • Autoplay silent videos with the autoplay attribute (demo)
  • Use videos as WebGL/ThreeJS textures (demo)

Demo

Main features

  • <2KB, standalone (no frameworks required)
  • No setup: include it, call enableInlineVideo(video), done
  • No custom API for playback, you can just call video.play() on click
  • Supports audio
  • Supports autoplay on silent videos
  • Doesn't need canvas
  • Doesn't create new elements/wrappers
  • It works with existing players like jPlayer
  • Disabled automatically on iOS 10+

Limitations:

  • Needs user interaction to play videos with sound (standard iOS limitation)
  • Limited to iPhone with iOS 8 and 9. iPad support needs to be enabled separately. It's disabled on Android.
  • The video framerate depends on requestAnimationFrame, so avoid expensive animations and similar while the video is playing. Try stats.js to visualize your page's framerate
  • Known issues

Install

Pick your favorite:

<script src="dist/iphone-inline-video.min.js"></script>
npm install --save iphone-inline-video
var enableInlineVideo = require('iphone-inline-video');
import enableInlineVideo from 'iphone-inline-video';

Usage

You will need:

  • a <video> element with the attribute playsinline (required on iOS 10 and iOS 11. Why?)

     <video src="file.mp4" playsinline></video>
  • the native play buttons will still trigger the fullscreen, so it's best to hide them when iphone-inline-video is enabled. More info on the .IIV CSS class

     .IIV::-webkit-media-controls-play-button,
     .IIV::-webkit-media-controls-start-playback-button {
         opacity: 0;
         pointer-events: none;
         width: 5px;
     }
  • the activation call

     // one video
     var video = document.querySelector('video');
     enableInlineVideo(video);
     // or if you're already using jQuery:
     var video = $('video').get(0);
     enableInlineVideo(video);
     // or if you have multiple videos:
     $('video').each(function () {
     	enableInlineVideo(this);
     });

Done! It will only be enabled on iPhones and iPod Touch devices.

Now you can keep using it just like you would on a desktop. Run video.play(), video.pause(), listen to events with video.addEventListener() or $(video).on(), etc...

BUT you still need user interaction to play the audio, so do something like this:

enableInlineVideo(video);
video.addEventListener('touchstart', function () {
	video.play();
});

If at some point you want to open the video in fullscreen, use the standard (but still prefixed) webkitEnterFullScreen() API, but it has some caveats.

Usage with audio-less videos

If your video file doesn't have an audio track, then must set a muted attribute:

<video muted playsinline src="video.mp4"></video>

Usage with autoplaying videos

The autoplay attribute is also supported, if muted is set:

<video autoplay muted playsinline src="video.mp4"></video>

Muted videos can also be played without user interaction — which means that video.play() doesn't need to be called inside an event listener:

<video muted playsinline src="video.mp4"></video>
setTimeout(function () { video.play(); }, 1000); // example

Usage on iPad

The iPad already supports inline videos so IIV is not enabled there.

The only reason to enabled IIV on iPad:

  • you want muted videos to autoplay, or
  • you want to play videos without user interaction

To enabled IIV on the iPad:

enableInlineVideo(video, {
	iPad: true
});

Notes about iOS 10

New features in iOS 10 and iOS 11:

  • videos play inline:

    <video playsinline src="video.mp4"></video>
  • muted videos play inline without user interaction:

    <video muted playsinline src="video.mp4"></video>
    setTimeout(function () { video.play(); }, 1000); // example
  • muted videos autoplay inline:

    <video autoplay muted playsinline src="video.mp4"></video>

Essentially everything that this module does, so iphone-inline-video will be automatically disabled on iOS 10-11. Make sure you use the playsinline attribute.

License

MIT © Federico Brigante

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].