In a children's educational-video app, a downloaded episode's licence expires during a flight; how should offline licences, renewal and the download cap be designed?
answer
- the licence, not the file, decides
- the licence server sets the windows
- renew while online, warn before trips
- a friendly card, never a black screen
- deleting must give back a slot
basics
~20 sFetch an offline licence with each download, store its expiry, renew near-expiry licences when online and warn parents before trips. A lapsed episode shows the child a friendly 'needs internet' card; deleting one releases its slot under the owner's cap.
solid answer
~50 sThe file is useless without its licence: a DRM system ties the offline keys to this device, and the content owner's licence server sets the windows, say an assumed 30 days to start watching and 48 hours once started. So I acquire the offline licence when the episode downloads, store its id and the expiry it states, and show 'available until' on each episode. Whenever the app is online it renews licences close to expiry, and a pre-trip check warns the parent about any that will lapse. If one lapses offline anyway, the DRM layer refuses to decrypt; the app maps that refusal to a calm card for the child, 'This one needs the internet again', and saves the position. The owner may also cap titles downloaded at once: a licence request can be refused, and deleting an episode must release its licence, queued until online.
code
pseudocode · 16 linesplay_downloaded(episode):
licence = licences.get(episode.licence_id)
if licence == none or licence.stated_expiry < device_now():
show_card("needs_internet", episode)
queue_renewal(episode)
return
result = player.play_offline(episode.file, licence.offline_keys)
if result in [keys_expired, keys_missing]:
save_position(episode)
show_card("needs_internet", episode)
queue_renewal(episode)
on connectivity restored:
send_queued_releases() # free slots under the cap first
for episode in downloads where licence near expiry or lapsed:
renew_licence(episode)go deeper
Recall that a downloaded protected episode needs a valid offline licence to play, that licences expire, and that the app renews them when it is online.
Explain acquiring the licence with the download, storing its expiry for display, renewing near-expiry licences when online, and the friendly card a child sees when one lapses.
Handle the edges: a refusal from the DRM layer mid-trip, the device clock as a hint only, releasing licences under a cap while offline, and keys tied to the device shaping backup and sign-out.
Treat licence terms as a negotiation between product and content owners: windows, caps and renewal rules a family can actually live with, surfaced honestly in the app.
## Why the licence, not the file, decides Protected video is stored **encrypted**. A **DRM system** (digital rights management) holds the keys that decrypt it, and for offline viewing it stores an **offline licence**: a set of keys plus the rules for using them, fetched from the content owner's **licence server** while the phone is online. Two consequences shape the design: - A fully downloaded file plays only while its licence is valid. The download can be perfect and the episode still unplayable. - The keys are issued to this device's DRM module, so copying the file to another phone, or restoring it from a backup onto a new one, does not make it play. Scenario assumptions, stated as such: the content owner grants an assumed 30 days to start an episode after download, an assumed 48 hours once playback starts, and up to an assumed 25 downloaded titles per account. None of these is a platform rule; each comes from the owner's licence terms. ## What the licence carries | Term | Set by | The app's job | |---|---|---| | Storage window: how long before first play | Licence server | Show "available until" on each episode | | Playback window: how long after first play | Licence server | Warn when a started episode is about to lapse | | Renewal: whether and how often it may be extended | Licence server | Renew when online, before the window closes | | Download cap: titles held at once per account | The owner's servers | Explain a refusal and offer to free a slot | ## Acquiring and renewing 1. **Acquire the licence with the download**, while the phone is online, and store its id in the episode's queue record. An episode is not marked ready to watch offline until both the file and its licence are present. 2. **Record the stated expiry** for display and warnings. It is a hint, not enforcement: the device clock belongs to the user, so the DRM layer and its licence are what actually allow or refuse playback. 3. **Renew opportunistically.** Whenever the app runs online, renew any licence within a margin of expiry, for example a few days, an assumption to tune. 4. **Run a pre-trip check.** When a parent opens the downloads screen, flag episodes that will lapse in the next day or two and offer to renew them now. 5. **Remind ahead.** A local reminder a day before a batch expires reaches the parent while the phone still has a connection. ## When a licence lapses offline On the plane, renewal is impossible, so the design is about what the **child** sees. - **Never a black screen or a raw error code.** The DRM layer's refusal is caught and mapped to a friendly card: the episode's picture, "This one needs the internet again", and a hint for the grown-up. - **Save the playback position**, so the episode resumes where it stopped after renewal. - **Lapsed episodes stay in the list**, marked as needing renewal, rather than silently disappearing, so the parent knows what happened. - **Check before starting**: if the stored expiry has already passed, show the card before playback rather than after a failed start, while still handling a refusal from the DRM layer at any moment. - **Renew on reconnect**: the first time the phone is online again, renew every lapsed episode in the background. ## The download cap and releasing licences The cap is counted on the **server**, typically when it issues licences, not on the phone. When the parent asks for one more title than the cap allows, the licence request is refused; the app explains it and lists which titles hold the slots. **Deleting** an episode must delete its keys and tell the server, so the slot frees up. Offline, the deletion happens at once on the phone, and the **release** is queued and sent when the connection returns; until then the slot shows as "freeing when online". ## DRM as a design constraint - **Exclude downloads from device backup**: a restored copy on a new phone has no valid keys, so it only wastes backup space; after a restore, offer to download again. - **Sign-out deletes downloads and their licences**, and releases each slot, so the next account on a shared family phone starts clean. - **Do not hand-roll protection**: the decryption and key storage belong to the platform's DRM module; the app owns the policy, the queue and the messages. - **Only on-demand episodes** can be downloaded, so offline-licence logic never meets a live stream. How the download queue itself survives suspension and force-quit is the download-queue question's.
- A parent changes the phone's date to keep an expired episode playing; should the app's own expiry check stop that?The app's stored expiry is for display and warnings only; it cannot be the enforcement, because the device clock is the user's to change. Enforcement belongs to the DRM layer and the licence it holds. So the app treats its own date check as a hint and always handles a refusal from the DRM layer at play time.
- The parent is at the download cap and offline, deletes one episode, and later wants another; what happens?Deletion removes the file and keys on the phone at once, but the server's count drops only when it hears of the release. Offline, the release is queued and the slot shows as freeing when online. Once connected, the app sends the release first, then requests the new licence; if the server still refuses, it lists the titles holding slots.
- Why exclude downloaded episodes from the phone's backup?They are large, they can be downloaded again, and their offline keys belong to the device that fetched them, so a copy restored onto a new phone would not play anyway. Excluding them keeps backups small; after a restore, the app sees episodes without valid licences and offers to download them again.
- Once a protected episode is fully on disk, it plays offline forever.
- The app's own clock check is enough to enforce the licence window.
- Licence windows and download caps are platform rules the app can hard-code.
- Deleting a download frees its slot under the cap at once, even offline.
- A downloaded protected file can be copied to another phone and played there.