LoginSignup
3

More than 5 years have passed since last update.

Ionicで動画のインライン再生するならconfig.xmlにも追記が必要

Last updated at Posted at 2018-10-17

iOS10から動画のインライン再生ができるようになりました。

ただし、Ionicの場合は config.xmlに以下の記述が必要です。忘れやすいので気をつけましょう。

config.xml
<preference name="AllowInlineMediaPlayback" value="true" />

https://cordova.apache.org/docs/ja/3.1.0/guide/platforms/ios/config.html

videoタグにはplayinlineを書きましょう

 <video 
       muted
       src="<動画のURL>" 
       poster="<サムネのURL>" 
       webkit-playsinline
       playsinline
       autoplay>
</video>

無音(muted)だと自動再生もされるようになります。
噂によると動画の音声トラックがないのも条件らしい(未確認)

ちなみに省電力モードだと自動再生されないので、背景動画等コントローラーなしで使う時はお気をつけて(動画を再生する手段がなくなります)

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3