GitHub - sighmon/SpaceX-TV: A SwiftUI app for watching SpaceX broadcasts from X on Apple TV and iPad. · GitHub
/" data-turbo-transient="true" />
Skip to content
Search or jump to...
Search code, repositories, users, issues, pull requests...
-->
Search
Clear
Search syntax tips
Provide feedback
--><br>We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
Saved searches
Use saved searches to filter your results more quickly
-->
Name
Query
To see all available qualifiers, see our documentation.
Cancel
Create saved search
Sign in
/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
sighmon
SpaceX-TV
Public
Notifications<br>You must be signed in to change notification settings
Fork
Star
main
BranchesTags
Go to file
CodeOpen more actions menu
Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit
History<br>88 Commits<br>88 Commits
SpaceXTV.xcodeproj
SpaceXTV.xcodeproj
SpaceXTV
SpaceXTV
SpaceXTVTests
SpaceXTVTests
screenshots
screenshots
scripts
scripts
.gitignore
.gitignore
README.md
README.md
View all files
Repository files navigation
SpaceX TV
Native tvOS SwiftUI app for watching SpaceX broadcasts from X on Apple TV.
The app discovers recent SpaceX broadcast posts, shows them as selectable poster cards, resolves playable X/Periscope streams, and plays them with AVPlayerViewController.
Features
X API timeline discovery from a hosted daily cache by default, with an opt-in user-supplied Bearer Token mode.
SpaceX Starship film discovery from the public STARSHIP media playlist on spacex.com.
Next-launch countdown loaded from the same SpaceX launches feeds used by spacex.com/launches.
Hosted X API cache fallback for users who have not configured their own Bearer Token.
SpaceX pinned post discovery, including pinned posts that link to x.com/i/broadcasts/....
Playback for live and ended broadcasts by resolving X web playback metadata at play time.
Highest-quality stream selection from available HLS or MP4 variants.
First load uses 25 recent SpaceX posts, showing every playable result, with deeper post fetches when scrolling to the end.
Daily cache for API discovery responses so app relaunches do not always hit X again.
Full-width tvOS player with end-of-video actions for Back and Replay.
Settings view opened from the gear button.
Secure Bearer Token field stored in Keychain.
Optional player debug overlay, off by default.
Broadcast cards with thumbnail backgrounds, tweet text, and date.
Broadcast Discovery
Discovery can use X API v2 with the user's own Bearer Token:
GET /2/users/by/username/spacex with user.fields=pinned_tweet_id
GET /2/tweets for the pinned post, when one exists
GET /2/users/{id}/tweets for recent SpaceX posts
By default, the app uses https://www.sighmon.com/spacex-tv/x-cache.json. The fallback JSON is generated by scripts/update_spacex_x_cache.rb and contains the same X API response shapes used by the app's token-backed discovery path, plus snapshots of the Starship film playlists, launch tiles, and Starship mission records. In Settings, Use Bearer Token data switches discovery to the user's own X API token when one is present.
The app reads attached media variants and linked broadcast URLs from every post returned by the current X API timeline request, then shows every playable result. It also reads SpaceX's STARSHIP media playlist so new Starship films appear automatically. Pinned, timeline, and Starship media results are de-duplicated by broadcast ID where possible, then by stream URL, normalized post text, status URL, or SpaceX media ID. Pinned posts stay at the top, timeline results follow by date, and Starship films are appended after the X posts. No profile-scraping or static HLS fallback URLs are bundled.
Settings
Open Settings with the gear icon in the root view.
Bearer Token: X API Bearer Token for timeline discovery.
Use Bearer Token data: off by default. When enabled, discovery uses the saved Bearer Token when present; otherwise it uses the hosted cache.
Player Debug Overlay: shows AVPlayer status, access log, and error log details while playing.
For simulator testing, the easiest token entry path is usually paste through the simulator keyboard. The token is saved to Keychain and is not hard-coded in the app.
Hosted X API Cache
The fallback cache is intended for shared hosting where Ruby and cron are available without extra packages. The script reads the X API Bearer Token from X_BEARER_TOKEN, fetches the latest 25 SpaceX posts, calculates their broadcast/gallery card results, snapshots SpaceX's Starship films, flight...