This commit makes several improvements to video coordination, and implements a new video control view. The video support stack in Damus has been re-architected to achieve this. The new architecture can be summarized as follows: 1. `DamusVideoCoordinator` is a singleton object in `DamusState`, and it is responsible for deciding which video should have the "main stage" focus, based on main stage requests that video player views make when they become visible. Having "main stage" focus means that the coordinator will auto-play that video and pause others, and is used throughout the app to determine which video to talk to or control, in the case of app-wide controls (analogous to how Apple Music needs to know which song is playing for displaying playback controls on the iOS home screen) Having a singleton take care of this establishes clear ownership and prevents conflicts such as double-playing video. This coordinator also holds a pool of video media items (`DamusVideoPlayer`), with exactly ONE `DamusVideoPlayer` per URL, to reduce bandwidth and ensure perfect syncing of the same video in different contexts. 2. `DamusVideoPlayer` objects hold the actual media item (video data, playback state), much like `AVPlayer`. In fact, `DamusVideoPlayer` can be described as a wrapper for `AVPlayer`, except it has an interface that is much more SwiftUI friendly, enabling playback state syncing with minimal effort. `DamusVideoPlayer` is NOT a view. And there is only ONE `DamusVideoPlayer` per URL — held by the coordinator. However, when the app needs to display that same video in multiple places, the app can instantiate multiple video player VIEWS of the same `DamusVideoPlayer` 3. `DamusVideoPlayer.BaseView` is the most basic video player view for a `DamusVideoPlayer` item. It has basically no features other than showing the video itself. 4. `DamusVideoPlayerView` is the standard, batteries-included, video player view for `DamusVideoPlayer` items, that is used throughout the app. It also tries to detect its own visibility, and makes requests to `DamusVideoCoordinator` to take over the main stage when it becomes visible. 5. `DamusVideoControlsView` is a view that presents video playback controls (play/pause, mute, scrubbing) for a `DamusVideoPlayer` object. How a `DamusVideoPlayerView` gains and loses main stage focus: 1. `DamusVideoPlayerView` uses `VisibilityTracker` to find out when it becomes visible or not 2. When it becomes visible, it makes a request to the video coordinator to take main stage focus. The request also specifies which layer the video view is in (Full screen layer? Normal app layer?), which the video player view gets from the `\.view_layer_context` environment variable set by `damus_full_screen_cover` 3. The coordinator (`DamusVideoCoordinator`) keeps all of these requests, and uses its own internal logic and info to determine which video should get the main stage. The logic also depends on whether or not the app finds itself in full screen mode. Once the main stage is given to a different video, the previous video is paused, the main-staged-video is played, and the requestor receives a callback. 4. Once the video disappears from view, it tells the coordinator that it is giving up the main stage, and the coordinator then picks another main stage request again. On top of this, several of other small changes and improvements were made, such as video gesture improvements Note: This commit causes some breakage over the image carousel sizing logic, which will be addressed separately in the next commit. Changelog-Fixed: Fixed iOS 18 gesture issues that would take user to the thread view when clicking on a video or unmuting it Changelog-Fixed: Fixed several issues that would cause video to automatically play or pause incorrectly Changelog-Fixed: Fixed issue where full screen video would disappear when going to landscape mode Changelog-Added: Added new easy to use video controls for full screen video Changelog-Changed: Improved video syncing and bandwidth usage when switching between timeline video and full screen mode Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
damus
A twitter-like nostr client for iPhone, iPad and MacOS.
How is Damus better than twitter?
There are no toxic algorithms.
You can send or receive zaps (satoshis) without asking for permission.
There is no central database. Therefore, Damus is censorship resistant.
There are no ads.
You don't have to reveal sensitive personal information to sign up.
No email is required.
No phone number is required.
Damus is free and open source software.
There is no Big Tech moat. Therefore, seamless interoperability with thousands or millions of other nostr apps is possible, and is how Damus and nostr win.
If there are no ads, how is Damus funded?
Damus offers a paid subscription 🟣 purple 🟣 https://damus.io/purple/.
Initial benefits include a unique subscriber number, subscriber badge, and auto-translate powered by DeepL.
Damus has also graciously received donations or grants from hundreds of Damus users, Opensats, and the Human Rights Foundation.
Spec Compliance
damus implements the following Nostr Implementation Possibilities
- NIP-01: Basic protocol flow
- NIP-04: Encrypted direct message
- NIP-08: Mentions
- NIP-10: Reply conventions
- NIP-12: Generic tag queries (hashtags)
- NIP-19: bech32-encoded entities
- NIP-21: nostr: URI scheme
- NIP-25: Reactions
- NIP-42: Authentication of clients to relays
- NIP-56: Reporting
Getting Started on Damus
Damus iOS
- Get the Damus app on the iOS App Store: https://apps.apple.com/ca/app/damus/id1628663131
⚙️ Settings (gear icon, top right)
- Relays: You can add more relays to send your notes to by tapping the "+".
- Find more relays to add: https://nostr.info/relays/
- Public Key (pubkey): Your public, personal address and how people can find and tag you
- Secret Key: Your private key unique to you. Never share your private key publicly and share with other clients at your own risk!
- Save your keys somewhere safe
- Log out
🏠 Personal Feed (home icon, bottom navigation)
- Feed from everyone you follow
- Can post notes by tapping the blue + button
Notes (under 🏠 Personal Feed)
- Sending a Note is easy and it goes to both your 🏠 Personal and 🔍 Global Feeds
- To tag a user you must grab their pubkey:
- Search their username in the search bar at the top of the 🔍 Global Feed and click their profile
- Tap the 🔑 icon which will copy their pubkey to your clipboard
- Go back to your 🏠 Personal Feed and tap the blue + button to compose your Note
- Add @ directly followed by the pubkey (e.g.,
@npub1xtscya34g58tk0z605fvr788k263gsu6cy9x0mhnm87echrgufzsevkk5s)
- You can also tap the ellipsis menu of a Note (three dots in top right of note) to grab their User ID aka pubkey or Note ID to link directly to a Note.
- Currently you can't delete your Notes in the iOS app
- Share images by pasting the image url which you can grab from nostr.build, imgbb, imgur, etc. (i.e.,
https://i.ibb.co/2SHZbwm/alpha60.jpg). Currently images only load for people you follow in the 🏠 Personal Feed. Images are not automatically loaded in 🔍 Global Feed - Engaging with Notes
- 💬 Replying to a Note: Tap the chat icon underneath the note. This will show up in the users’ notifications and in your 🏠 Personal and 🔍 Global Feeds
- ♺ Reposts: Tap the repost icon which will show up in your 🏠 Personal and 🔍 Global Feeds
- ♡ Likes: Tap the heart icon. Users will not get a notification, and cannot see who liked their note (currently, web clients can see your pfp only)
💬 Encrypted DMs (chat app, bottom navigation)
- Tap the chat icon and you'll notice there's nothing to see at first. Go to a user profile and tap the 💬 chat icon next to the follow button to begin a DM
🔍 Global Feed (magnify glass, bottom navigation)
- View the Global Feed from all the relays you've added in ⚙️ Settings. Currently you can only search hashtags and user names and pubkeys
🔔 Notifications
- All your notifications except 💬 DMs
👤 Change Your Profile (PFP) and Bio
- Go to your Profile Page on Damus app
- Tap on Edit button at the top
- You will see text fields to update your information and bio
- For PFP, insert a URL containing your image (support video: https://cdn.jb55.com/vid/pfp-editor.mp4)
- Save
⚡️ Request Sats
Paste an invoice from your favorite LN wallet. (Sats or Satoshis are the smallest denomination of bitcoin)
Alby (browser extension)
- Get the Alby browser extension and create your Alby address [yourname]@getalby.com or connect your existing Lightning wallet
- Convert your Damus secret key from nsec to hex at https://damus.io/key then go to Settings in Alby and under the Nostr section at the bottom of the page add your private hex key. You can also generate new address in the extension
- Click the Alby extension > click Receive > enter the amount of Sats > click Get Invoice > click Copy > then paste into Damus
- Note: On Damus Web it will appear as a string of characters but on Damus iOS it will appear as a clickable image
Zeus (mobile app)
- Download Zeus app (iOS, Google, APK)
- Tap Get Started button > tap Connect a node > click on + sign (top right) > select Indhub > press Scan Lndhub QR > (from the Alby browser extension… click your account on the top left > click Manage Accounts > click 3-dot menu to right of your account and click Export Account to get a QR code then go back to Zeus app) > scan the QR Code and tap Save Node Config button
- To create an invoice tap Lightning > tap Receive > type in amount > tap Create Invoice > tap Copy Invoice > paste into a new Damus note
Contributing
Contributors welcome! Start by examining known issues: https://github.com/damus-io/damus/issues.
Mailing lists
We have a few mailing lists that anyone can join to get involved in damus development:
- dev - development discussions
- patches - code submission and review
- product - product discussions
- design - design discussions
Contributing
Privacy
Your internet protocol (IP) address is exposed to the relays you connect to, and third party media hosters (e.g. nostr.build, imgur.com, giphy.com, youtube.com etc.) that render on Damus. If you want to improve your privacy, consider utilizing a service that masks your IP address (e.g. a VPN) from trackers online.
The relay also learns which public keys you are requesting, meaning your public key will be tied to your IP address.
It is public information which other profiles (npubs) you are exchanging DMs with. The content of the DMs is encrypted.
Translations
Translators welcome! Join the Transifex project.
All user-facing strings must have a comment in order to provide context to translators. If a SwiftUI component has a comment parameter, use that. Otherwise, wrap your string with NSLocalizedString with the comment field populated.
Awards
Damus lead dev and founder Will awards developers with satoshis! There may be nostr badges awarded for contributors in the future... :)
First contributors:
- @randymcmillan
- @jcarucci27
git log bot
npub1fjtdwclt9lspjy8huu3qklr7eklp5uq90u6yh8mec290pqxraccqlufnas