SRGSSR / pillarbox-web

Pillarbox is a versatile media playback ecosystem engineered for the web.
https://srgssr.github.io/pillarbox-web-demo/
MIT License
12 stars 1 forks source link

feat(srgssr-middleware): allow overriding of resource properties #243

Closed amtins closed 5 months ago

amtins commented 5 months ago

Description

Improves the resource property overriding mechanism when the mediaData object is provided to player.src. In certain scenarios, developers may want to add a subtitle track not provided by the media composition or even replace the media being played.

Although this use case is rare, it's essential to offer developers the flexibility to do so, ensuring a smoother developer experience.

[!TIP] How to override a resource properties

const player = pillarbox('player');

// overrides the URL and adds a blocking reason
player.src({
  src: 'urn:bu:media:id', 
  type:'srgssr/urn'
  mediaData: {
    url: 'https://fake-url.com/new-media.m3u8',
    mimeType: 'application/x-mpegURL',
    blockedSegments:[{
      blockReason: "ENDDATE",
      markIn: 5_000,
      markOut: 60_000,
    }]
  }
});

[!CAUTION] It's the developer's responsibility to ensure data consistency, otherwise unexpected errors may occur, preventing the media from playing.

Changes made

github-actions[bot] commented 5 months ago

PR Preview Action v1.4.7 :---: Preview removed because the pull request was closed. 2024-04-15 09:22 UTC

github-actions[bot] commented 5 months ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟢 Statements
98.71% (+0% 🔼)
613/621
🟢 Branches 95.71% 290/303
🟢 Functions 99.42% 172/173
🟢 Lines
99.14% (+0% 🔼)
579/584

Test suite run success

198 tests passing in 9 suites.

Report generated by 🧪jest coverage report action from 1b1dba9a1ecf5fc7e301dc529e7f0f21cec418e3

github-actions[bot] commented 5 months ago

:tada: This PR is included in version 1.11.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: