Supporting custom playback strategies

Aperta
#382 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
frontend

Direzione di ricerca

Inizia da src/playbackstrategy/strategypicker.js e dalla definizione di PlaybackStrategy, quindi esamina le linee guida per i contributi collegate nell’issue. Confronta l’opzione customstrategy proposta con l’alternativa di un nome di esportazione fisso e definisci un’API accettata e i criteri di completamento prima di implementare il supporto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

I want to try other playback implementations (like hls.js) to explore features in some TV models, but the strategy picker code is restricted to the current implemented strategies.

So, instead of opening a PR adding support for N playback implementations, it's healthier to support custom playback strategies. Following the contributing guidelines, I opened this issue to discuss it 🙃

One suggestion is to map a new playback strategy called customstrategy at PlaybackStrategy and add an option to propagate the path to the StrategyPicker to do something like:

function StrategyPicker(customStrategyPath) {
  return new Promise((resolve, reject) => {
    if (window.bigscreenPlayer.playbackStrategy === PlaybackStrategy.MSE) {
      return import("./msestrategy")
        .then(({ default: MSEStrategy }) => resolve(MSEStrategy))
        .catch((reason) => {
          const error = new Error(isError(reason) ? reason.message : undefined)
          error.name = "StrategyDynamicLoadError"

          reject(error)
        })
    } else if (window.bigscreenPlayer.playbackStrategy === PlaybackStrategy.CUSTOM && customStrategyPath !== "") {
      return import(customStrategyPath)
        .then(({ default: CustomStrategy }) => resolve(CustomStrategy))
        .catch((reason) => {
          const error = new Error(isError(reason) ? reason.message : undefined)
          error.name = "StrategyDynamicLoadError"

          reject(error)
        })
    } else if (window.bigscreenPlayer.playbackStrategy === PlaybackStrategy.BASIC) {
      return resolve(BasicStrategy)
    } 
    return resolve(NativeStrategy)
  })
}

Another possibility is to force the custom playback strategy export one expected name (like CustomStrategy), avoiding the new option.

Those suggestions have the drawback of only supporting one instance of a custom playback strategy, but resolve my initial tests 🙃

Lingua principale
JavaScript
Stelle
108
Fork
18
Merge medio
1h 30m
PR unite (30g)
2

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bbc/bigscreen-player

Tutte le issue di bbc/bigscreen-player

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.