How To: LocalStorage Persistence
Problem
You want users to resume playback from where they left off after reloading the page.
Solution
Add an id attribute to your root timegroup. The element automatically saves and restores currentTime to localStorage.
<ef-timegroup id="my-video" mode="fixed" duration="60s"><!-- Playback position persists across page reloads --></ef-timegroup>
Storage key: ef-timegroup-${id}
Automatic behavior:
- Saves
currentTimeafter each seek - Restores
currentTimeon page load (if key exists) - Only applies to root timegroups with an
idattribute