-
Notifications
You must be signed in to change notification settings - Fork 535
Attachments ‐ Improving Multimedia Support
While the primary focus of NNW is certainly written articles, a lot of content has moved to (and might only be available in) other mediums like audio and video.
And most of the benefits of using RSS applies to these other mediums too like:
- Users being in control of their feeds
- Offline consumption
- No distracting recommendation algorithms, designed to maximise watch/listen time instead of quality information.
- Since NNW is an open source project it's important new features are implemented in a way, that does not increase the amount of support required.
- The implementation should not require themes to be updated, since there might be many users using unofficial or modified themes.
The feature could be implemented in 3 distinct steps:
The good news is that RSParser
already has RSParser.ParsedAttachment
which is parsed from most feed types.
The proposal is to add a Set<Attachment>
to the Articles.Article
struct.
Basically a type-safe version of what's outlined in jsonfeed:
struct Attachment {
let url: URL
let type: UTType
let title: String?
let sizeInBytes: UInt?
let durationInSeconds: UInt?
}
The attachments would be stored in the database similarly to how Articles.Author
is already handled with many-to-many relationship and uniquely identified by the url:
extension Attachment: Identifiable {
var id: URL { url }
}
download-button.mp4
The simplest solution would be to add a button that downloads the attachments (showing progress), and then presents all attachments in QLPreviewController
allowing user to view and store the attachments.
This solution would also serve as a fallback for older versions of OS
The files could be downloaded to temporaryDirectory
/hashOfTheFile
/url.lastPathComponent
For quicklook to work correctly, the URL requires a corresponding file extension.
More involved approach could be to show the attachments above the article, including:
- Title (fallback to last path component of the url)
- Download button for each file
- Optional preview for images, audio and video
There are few additional issues that would improve media support and UX:
- Support Media RSS - improved attachment decoding
- Improve/Align media playback modes - background modes and PiP