fix(dailymotion): Player ID obligatoire dans l'URL d'embed
CI / build-and-test (push) Successful in 14m58s

Dailymotion exige désormais un Player ID (fév. 2026) : player.html?video=...
sans Player ID répond HTTP 403 'Forbidden'. L'URL correcte est
geo.dailymotion.com/player/{PLAYER_ID}.html?video=...

- helper dailymotionPlayerId()/dailymotionEmbedBase() (config window.DAILYMOTION_PLAYER_ID, repli demo x8lr5)
- /watch et /shorts utilisent le nouvel endpoint avec Player ID
- config.local.example.js documente la config
This commit is contained in:
2026-09-30 21:48:06 -04:00
parent c391be80e5
commit 2bcc7321aa
4 changed files with 49 additions and 15 deletions
@@ -0,0 +1,33 @@
/**
* Dailymotion : Player ID obligatoire (fév. 2026).
*
* Dailymotion a rendu le Player ID obligatoire sur le nouvel endpoint
* d'embed : `https://geo.dailymotion.com/player.html?video=…` SANS Player ID
* répond désormais HTTP 403 « Forbidden ». L'URL correcte est
* `https://geo.dailymotion.com/player/{PLAYER_ID}.html?video=…`.
*
* Configurable via `window.DAILYMOTION_PLAYER_ID` (assets/config.local.js).
* Repli sur un Player ID de démonstration public (`x8lr5`, fourni par la
* documentation Dailymotion) pour que l'embed fonctionne sans configuration.
* En production, créez votre propre Player (Dailymotion Studio → Players) et
* renseignez son ID — idéalement un player vertical (aspect_ratio 9:16) pour
* les Shorts.
*/
const DM_PLAYER_ID_DEFAULT = 'x8lr5';
/** Player ID Dailymotion effectif (config explicite sinon démonstration). */
export function dailymotionPlayerId(): string {
try {
const g = globalThis as any;
const raw = g?.DAILYMOTION_PLAYER_ID;
const v = typeof raw === 'string' ? raw.trim() : '';
if (v) return v;
} catch {}
return DM_PLAYER_ID_DEFAULT;
}
/** Base de l'URL d'embed Dailymotion (nouveau endpoint + Player ID). */
export function dailymotionEmbedBase(videoId: string): string {
return `https://geo.dailymotion.com/player/${encodeURIComponent(dailymotionPlayerId())}.html?video=${encodeURIComponent(videoId)}`;
}
+5 -11
View File
@@ -15,6 +15,7 @@ import { AuthService } from '../../services/auth.service';
import { Video } from '../../models/video.model';
import { shortsFeedAccepts, isPlayable as isPlayablePolicy, type PlayableContext } from '../../app/shared/utils/section-policy';
import { SHORT_TO_LONG, type ProviderId } from '../../app/shared/providers/provider-ids';
import { dailymotionEmbedBase } from '../../app/shared/providers/dailymotion-player';
import { SearchService } from '../../app/search/search.service';
import { ChannelProviderFactory } from '../../app/core/providers/channel/channel-provider.factory';
import {
@@ -375,18 +376,11 @@ export class WatchShortComponent implements OnDestroy {
return this.sanitizer.bypassSecurityTrustResourceUrl(u);
}
if (p === 'dailymotion' && v.videoId) {
// Nouveau player obligatoire depuis fév. 2026 (l'ancien /embed est
// coupé et répond "Forbidden"). Seuls mute/startTime/loop passent
// en query sans Player ID ; autoplay est tenté au mieux.
// Correctif bug "Forbidden" systématique en Shorts alors que /watch
// (toujours muet) joue la même vidéo : on démarre MUET comme /watch
// (même URL, mute=1) et on ne passe au son QUE sur action explicite
// du bouton Son — le clic EST le geste qui autorise le son (même
// motif que le player Odysee, cf. soundTouched). L'autoplay sonore
// sans geste préalable est bloqué et le player par défaut l'affiche
// comme "Forbidden".
// Nouveau player + Player ID obligatoire depuis fév. 2026 (player.html
// sans Player ID répond "Forbidden"). Démarrage MUET (comme /watch),
// son uniquement sur action explicite du bouton Son.
const withSound = !this.muted() && this.soundTouched();
const u = `https://geo.dailymotion.com/player.html?video=${encodeURIComponent(v.videoId)}&mute=${withSound ? 0 : 1}&autoplay=1`;
const u = `${dailymotionEmbedBase(v.videoId)}&mute=${withSound ? 0 : 1}&autoplay=1`;
return this.sanitizer.bypassSecurityTrustResourceUrl(u);
}
if (p === 'twitch' && v.videoId) {
+4 -4
View File
@@ -17,6 +17,7 @@ import { ChannelsService } from '../../services/channels.service';
import { SubscriptionsService } from '../../services/subscriptions.service';
import type { ChannelMeta, ProviderId } from '../../app/shared/models/channel.model';
import { toShortProviderId } from '../../app/shared/providers/provider-ids';
import { dailymotionEmbedBase } from '../../app/shared/providers/dailymotion-player';
import { SubscribeButtonComponent } from '../../app/shared/components/subscribe-button/subscribe-button.component';
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
import { IframeProgressService } from '../../services/iframe-progress.service';
@@ -402,10 +403,9 @@ export class WatchComponent implements OnDestroy, AfterViewInit {
return this.sanitizer.bypassSecurityTrustResourceUrl(u);
}
if (p === 'dailymotion') {
// Nouveau player obligatoire depuis fév. 2026 (l'ancien /embed est
// coupé et répond "Forbidden"). Seuls mute/startTime/loop passent
// en query sans Player ID.
let u = `https://geo.dailymotion.com/player.html?video=${encodeURIComponent(id)}&mute=1&autoplay=1`;
// Nouveau player + Player ID obligatoire depuis fév. 2026 (l'ancien
// /embed et player.html sans Player ID répondent "Forbidden").
let u = `${dailymotionEmbedBase(id)}&mute=1&autoplay=1`;
if (start > 0) u += `&startTime=${start}`;
return this.sanitizer.bypassSecurityTrustResourceUrl(u);
}