Skip to content

Add SRF / SRG SSR adapter (Swiss public broadcasting) - #7

Open
achterbahn wants to merge 1 commit into
HitkoDev:masterfrom
achterbahn:feature/srf-adapter
Open

Add SRF / SRG SSR adapter (Swiss public broadcasting)#7
achterbahn wants to merge 1 commit into
HitkoDev:masterfrom
achterbahn:feature/srf-adapter

Conversation

@achterbahn

Copy link
Copy Markdown

Summary

This PR adds support for SRF Play (Swiss Radio and Television) video links, along with the other SRG SSR channels (RTS, RTR, RSI, SWI), following the existing adapter architecture.

Note: This PR was created with the assistance of Claude (Anthropic). Code authored by hefe / Pixmill (f.christen@pixmill.ch), co-authored by Claude Sonnet 4.6.

New files

  • core/components/videobox/model/adapters/srf.class.phpSrfVideo adapter class
  • core/components/videobox/elements/snippets/snippet.srf.php — processor snippet registered as SRF

Modified files

  • _build/data/transport.snippets.adapters.php — registers SRF as the first adapter in the pipeline
  • _build/data/properties/properties.videobox.php — adds SRF to the default processors list; updates default player dimensions to 960×540 (16:9)
  • core/components/videobox/model/videobox/videobox.class.php — removes hardcoded $_GET['dev'] debug server paths from loadAssets(); adds null-check before reading overrides.min.css
  • _build/build.transport.php — pre-defines URL constants needed for CLI execution; removes FILE_RESOLVE_OPTIONS (not available in MODX 2.8.x); version bumped to 6.1.0-pl
  • CHANGELOG.md / README.md — updated

SRF adapter details

The SrfVideo adapter handles all four input forms:

Input Resolved embed URL
https://www.srf.ch/play/tv/-/video/-?urn=urn:srf:video:UUID https://www.srf.ch/play/embed?urn=urn:srf:video:UUID
https://www.srf.ch/play/tv/redirect/detail/UUID https://www.srf.ch/play/embed?urn=urn:srf:video:UUID
urn:srf:video:UUID https://www.srf.ch/play/embed?urn=urn:srf:video:UUID
UUID (plain) https://www.srf.ch/play/embed?urn=urn:srf:video:UUID

Sister-channel detection is automatic by domain — the same URL patterns on rts.ch, rtr.ch, rsi.ch, and swissinfo.ch are handled with their respective channel URNs and embed endpoints.

Thumbnails are fetched from the SRG SSR Integration Layer API (il.srgssr.ch), with a fallback to the nobg_video placeholder if the API is unreachable.

Usage

[[Videobox? &videos=`https://www.srf.ch/play/tv/-/video/-?urn=urn:srf:video:608cc6ac-2262-4bfb-98ce-d04f58df5438|Tagesschau`]]
[[Videobox? &videos=`https://www.srf.ch/play/tv/redirect/detail/acedb774-8d9c-43f1-9a12-26a9a31083ff|My SRF Video`]]

Test plan

  • SRF share URL with ?urn= query parameter resolves correctly
  • SRF redirect/detail URL resolves correctly
  • Plain URN resolves correctly
  • Plain UUID resolves correctly
  • RTS/RTR/RSI/SWI URLs resolve to correct channel URN and embed host
  • Thumbnail fetches from SRG SSR API (requires network access)
  • Falls back to nobg_video placeholder when API unreachable
  • SRF snippet listed first in Adapters category after install
  • Existing YouTube / Vimeo / SoundCloud / HTML5 / Twitch adapters unaffected
  • Build script runs cleanly from CLI: php _build/build.transport.php

🤖 Generated with Claude Code

Adds support for Swiss public broadcasting (SRF) video links — both
share URL formats, plain URNs, and plain UUIDs — as well as the SRG
SSR sister channels RTS, RTR, RSI and SWI.

Changes
-------
* core/model/adapters/srf.class.php (NEW)
  - SrfVideo extends VideoboxAdapter
  - resolves all input forms to a canonical urn:srf:video:UUID
  - getPlayerLink() → https://www.srf.ch/play/embed?urn=…
  - getThumb() fetches the image from the SRG SSR Integration Layer API
  - sister-channel detection by domain (rts.ch, rtr.ch, rsi.ch, swissinfo.ch)
  - static SrfVideo::matches() for the processor snippet

* elements/snippets/snippet.srf.php (NEW)
  - thin processor wrapper, registered as "SRF" in the adapter pipeline

* _build/data/transport.snippets.adapters.php
  - registers SRF as the first adapter (checked before YouTube/Vimeo)

* _build/data/properties/properties.videobox.php
  - default processors list now: "SRF, Twitch, YouTube, Vimeo, SoundCloud, HTML5"
  - default player dimensions updated to 960×540 (16:9)

* model/videobox/videobox.class.php
  - removed hardcoded $_GET['dev'] debug paths in loadAssets()
  - added null-check for overrides.min.css before file_get_contents

* _build/build.transport.php
  - pre-defines URL constants required for CLI execution
  - removed FILE_RESOLVE_OPTIONS constant (not available in MODX 2.8.x)
  - package version set to 6.1.0-pl

* CHANGELOG.md / README.md updated

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant