kino
kino copied to clipboard
Offline Mode: video player does not allow Download
Bug Description
Given a user who has stored the video for offline viewing When the network connection is cut and the offline video is playing in the player Then it is NOT possible to click the Download button within the video player to download the file to the machine
Expected Behaviour
If the offline behavior of the video player should match the behavior when the system is online, then the download button should work the same way. On the other hand, if downloads from offline IDB is NOT allowed, then we need to disable the download button or indicate this in a better way than a failed attempt.
Steps to reproduce
- Go to KINO Staging Site on Google Chrome
- Download one of the videos for offline viewing.
- Now break the internet connection to the device by switching off WiFi or going into Airplane mode without data connection
- Play the downloaded video
- You will notice that the video player has a option to download the video file on the far right hand side
- Click on download option in the video player interface
- The file does not download and there is a "Failed - Network Error" message.
Screenshots
Screen shot of failed download due to network error after clicking the download button from video player after cutting the connection -
Additional context
- Project version: https://github.com/xwp/web-dev-media/commit/da8ec7def7bae188cc494f033b0612e2c1ea0f8c
- Node version: n.a.
- OS: Win10
- Browser: chrome
- Device: Galaxy S III
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation brief
QA testing instructions
Demo
Changelog entry
@kkalarickal Agreed, the Download
button should work regardless of connection status. I believe you've encountered an unrelated issue that has been fixed in the latest batch of updates.
Can you please re-test?
- https://web-dev-media.web.app/conditional-polyfills
I just checked that Download
works in online and offline mode as expected.
@dero - I think the difference that I am seeing is because I actually cut off the network connection before trying to download the video from offline storage.
In general, there seems to be a difference between turning-a-service-worker to "Offline" in the DevTools > Applications tab and cutting off network connection by turning off the WiFi or data on a mobile.
For example, there is a "No Internet Connection" status message that appears when you turn service-worker offline
This does NOT appear when you cut network connection
@kkalarickal Yes, cutting the connection is a case different from selecting "Offline" in the dev tools. From the MDN documentation about navigator.onLine
:
So while you can assume that the browser is offline when it returns a false value, you cannot assume that a true value necessarily means that the browser can access the internet. You could be getting false positives, such as in cases where the computer is running a virtualization software that has virtual ethernet adapters that are always "connected."
We would need to employ a more reliable method of detecting when the client goes offline. I'm not sure if this should be a part of our Phase 1 efforts, though, because each possible approach is a non-trivial one.
Perhaps we should create a ticket to tackle this later? cc @jwold @derekherman
Moving this issue into phase two or later sounds like the right thing to do here.
@jwold - Should tickets in QA column that are going to be addressed in phase two or later be moved back into Backlog ? Or is "Revisit Later" the correct column ?
I'm not sure why that is happening, it may be part of prepping the release, but not sure.
I've re-tested the issue here and I now believe fixing it would be a significant lift that is unlikely to be worth the effort.
- The "Download" button is a part of the
<video>
element UI rendered by the browser. It is only displayed when a single static video file is played, it's not displayed when video is streamed using MSE. - In other browsers, e.g. Firefox, the same function can be accessed by right clicking the video and selecting "Save video as...".
- There is no event I know of we could tap into in order to handle the download request ourselves.
- We would likely need to build our own UI to allow users to download a video file in all contexts in a way that we could control.
- We already have offline mode support, so it's debatable whether we even want to allow users to download video files from the application instead of just using the inbuilt offline support.
I'd actually suggest we add a controlslist="nodownload"
attribute to all <video>
elements and suppress the native UI Download button in browsers that support controlslist
.
@derekherman, what do you reckon?