Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thoughts for a v4.0.0 #881

Closed
82 of 87 tasks
peaBerberian opened this issue Jan 20, 2021 · 3 comments · Fixed by #1029
Closed
82 of 87 tasks

Thoughts for a v4.0.0 #881

peaBerberian opened this issue Jan 20, 2021 · 3 comments · Fixed by #1029
Labels
API Relative to the RxPlayer's API v4.0.0 Candidate PR/issue for a v4.0.0 release
Milestone

Comments

@peaBerberian
Copy link
Collaborator

peaBerberian commented Jan 20, 2021

This is an issue to discuss about what we could do in a v4.0.0 and how to do it.

Why?

A new major version will let us "break" the API in its current state, this can allow much larger modifications than regular releases.
The main downside being that an API overhaul might be a chore to developers wanting to do the switch.
That's the reason why we refrained from doing that since the end of 2017, which is a relatively long period.

So this is mainly to help us maintain and make evolution to the code. A user might expect shiny new features from a new major version in return for the hassle but I think that even in the case where we find nothing really attractive to provide here, we should still go on with a v4.

Objectives of a v4

To me, the main objectives of a v4.0.0 for now would be:

  1. Allow us to make much bigger changes to the RxPlayer's code.

    I'm thinking about methods that handicap us like getManifest, getCurrentAdaptations and getCurrentRepresentations as they reveal too much the player's internal data (which forces us to do ugly things like manifest: a segment's timescale is now always set to 1 #860).

  2. Allow us to provide a sane behavior by default.

    By default, the RxPlayer stops automatically (and unloads the content) when it reaches the ENDED state.
    To disable that strange behavior, we added the stopAtEnd player option, which is set to true by default to maintain API compatibility. Here setting it to false by default, or even just removing it (the application can replicates the same behavior through simple events) might be less surprising to someone using the API.

    I'm also thinking about the fact that we avoid switching to the RELOADING state unless if an option explicitly documenting that new state was enabled.
    With a new major version, we could add that state to the "regular" received states (which breaks both playerStateChange and getPlayerState). This could allow to avoid decoding errors and infinite stalling issues without the need to rely on an option.

  3. Simplify the API.

    There's a lot of deprecated methods, events and options we could either do without (e.g. hideNativeSubtitles loadVideo option) or even some we do not want developers to use at all (like setFullScreen, because it does not take into account HTML subtitles into full-screen). This would have the double advantage of removing a lot of code and of making the API more digestible.

    Also I find like some DASH-inspired terms like "Representation" and "Adaptation" are less intelligible than the more common "Rendition"/"Profile"/"Quality" and "Track". An API change might be the occasion to update method name so they can be discovered more easily.

  4. Provide a simpler API for rendition/profile selection.

    As exposed in [proposal] APIs to choose a specific Representation #877, we miss in the RxPlayer simple APIs to select a specific rendition. From recent discussions, we realized that it may makes sense to remove the set{Audio,Video}Bitrate methods (but keeping the min/max ones) in profit of a set{Video,Audio}Representation one.

  5. Facilitate HLS support.
    Supporting HLS is in our mind since several years, although it was always kept at low priority.
    A v4.0.0 could allow us to facilitate that task, for example by defining new ways to approach some APIs.

    Also, it would nice to have such a big feature introducing a v4.0.0, though we would have to provide much more work to arrive to that point.

  6. Facilitate MSE-in-worker support

That's all I'm thinking of for now, do not hesitate to bring other points in there.

How to begin

As we're still in the very early phases and as we plan to do a big overhaul, it is difficult to know how to start.

RxPlayer episode 4: A new branch

Because we still need to start somewhere, I chose to create a new branch, named next-v4 (which is rebased on next) which will add every commits we are confident that we want to add to a v4.0.0.
This is not definitive however, and we may create other similar branches in the future.

Having a supplementary branch running in parallel makes maintenance harder as new developments have to also be added to the next-v4 branch. For the moment, I don't think that this is a huge problem because we're such in an early phase that we will mostly be bringing reflexions, not complex refactos.

For now, I think that we will keep next-v4 up-to-date with next (itself up-to-date with master) but if it becomes too much of a burden, we could be led to re-create another branch on top of next. Time will tell if a more inflexible strategy has to be taken in the future.

I already began removing fullscreen APIs in that branch, as we're pretty sure we want to include it in the next major version.

Current ideas

I will list here the ideas we currently have and check the boxes for things which are already included in the next-v4 branch.
Those put in bold will be ideas that have been approved by every maintainers (@PaulRosset and I).
One of the main role of this issue would be to discuss those and decide which other ideas we put in there.

BREAKING CHANGES

  • ([V4] Add FREEZING state #1146) Create "FREEZING" state for cases where the playback position is currently not advancing due to an unknown reason
  • Remove fullscreen related APIs (methods: isFullscreen, setFullscreen, exitFullscreen, event: fullscreenChange).as a a UI is much more adapted to that task and can also bring with it things like a progress bar or HTML text tracks
  • Remove stopAtEnd loadVideo option and never automatically stop at the end by default.
    This behavior can be counter-intuitive and can be very easily implemented by the UI
  • ([v4] Remove decipherabilityUpdate event #1168) Remove decipherabilityUpdate event as it appeared to be not easily exploitable and exposed internal logic too much
  • ([Proposal] [v4] Remove initialVideoBitrate and initialAudioBitrate, add baseBandwidth #1155) Remove initialAudioBitrate and initialVideoBitrate constructor options with a single baseBandwidth option, which better translates what this option is actually doing and allows for future optimizations on our side.
  • allow the RELOADING player state (gettable through the getPlayerState and playerStateChange API) to happen at any time.
  • Rename networkConfig into requestConfig and re-organize its inner properties to pave the way for future request-related APIs.
  • Flatten or rename the networkConfig loadVideo option?
  • Remove deprecated getNativeTextTrack method.
    If advanced features are wanted, it's better to just use the HTML text track API
  • Remove deprecated nativeTextTracksChange event.
    Same reason than for getNativeTextTrack
  • Remove deprecated hideNativeSubtitles from loadVideo options
    Same reason than for getNativeTextTrack
  • Remove xhr property from a NetworkError.
    Doing so stop us from using the fetch API
  • Remove deprecated defaultAudioTrack and defaultTextTrackin profit of new track APIs
  • Remove getUrl method in profit of the more powerful getContentUrls
  • Remove public types ISupplementaryTextTrackOption and ISupplementaryImageTrackOption.
    Those are the types respectively for supplementaryTextTracks and supplementaryImageTracks which have been removed
  • Remove public types IBitrateEstimate as no API depend on it anymore.
  • Remove public types IManifest, IPeriod, IAdaptation, IRepresentation, IRepresentationInfos, IBifThumbnail, IBifObject and IExposedSegment as no API depend on them anymore.
  • Remove public types IDefaultAudioTrackOption and IDefaultTextTrackOption.
    Those are the types respectively for defaultAudioTrack and defaultTextTrack loadVideo options which have been removed
  • remove methods: getManifest, getCurrentAdaptations and getCurrentRepresentations, as they reveal the RxPlayer's internals too much
  • remove resolve step from HSS pipelines (legacy features which allowed to fetch an URL which itself gives the URL of the Manifest. Needed for some Canal+-specific usages).
  • Remove supplementaryTextTracks loadVideo option
  • Rename maximumBufferTime in positionUpdate events to maximumPosition
  • Remove getVideoPlayedTime API.
    Its name was very confusing and can be re-implemented relatively easily using the media element's buffered property
  • Remove getVideoLoadedTime API.
    Exact same reason than for getVideoPlayedTime
  • Rename getVideoDuration to getMediaDuration
  • Rename getVideoBufferGap to getCurrentBufferGap
  • Remove every image-related API and code (supplementaryImageTracks loadVideo option, imageTrackUpdate event, getImageTrackData method)
  • ([V4] DRM: Remove persistentLicense keySystems option and rename licenseStorage to persistentLicenseConfig #1147) Replace keySystems[].licenseStorage keySystems option (for a loadVideo call) by the better-named persistentLicenseConfig. The persistentLicense boolean (also a keySystems option) has also been removed because it was redundant with the former option)
  • Remove deprecated throttleWhenHidden player option in profit of throttleVideoBitrateWhenHidden
  • periodChange events don't emit the full Period structure but a small subset of it.
  • (Future-proof the transport code for a v4.0.0 #995) transportOptions.segmentLoader loadVideo options don't give the full Manifest, Period, Adaptation, Representation and ISegment structures in arguments but a small subset of it.
  • (Future-proof the transport code for a v4.0.0 #995) a custom manifestLoader added to the loadVideo's transportOptions now set an object as argument (with an urlproperty), to let us bring improvements on it in the future
  • A Representation's frameRate is now always a number - in terms of frame per seconds - instead of a string
  • Representations (in methods: getAvailableVideoTracks, getVideoTrack, representationFilter, getAvailableAudioTracks, getAudioTrack and events: audioTrackChange and videoTrackChange) can have an undefined bitrate
  • Remove aggressiveMode from the transportOptions (the loadVideo option)
  • Remove bitrateEstimationChange event
    It is poorly understood (it's not always close to the expected bandwidth) and has a very complex relationship with the chosen quality. It is also an event that is today very often triggered (some application might rely on that) and that may not always be simple to bubble up to the API

    -> Rename event as undocumented __priv_bitrateEstimateChange event for specialized usage at Canal+ without guaranteeing API stability
  • ([WIP] Refacto track and quality selection for the v4.0.0 #1029) Rename audioTrackSwitchingMode loadVideo option into defaultAudioTrackSwitchingMode
  • ([WIP] Refacto track and quality selection for the v4.0.0 #1029) Remove manualBitrateSwitchingMode loadVideo option as it is not clear how it would interact at each switchingMode property at each lockVideoRepresentations and lockAudioRepresentations.
  • Remove getManualVideoBitrate and getManualAudioBitrate in profit of the Representations lock APIs
  • ([V4] Remove all bitrate-based API #1144) Remove bitrate API: getAvailableVideoBitrates, getAvailableAudioBitrates, setAudioBitrate, setVideoBitrate, getAudioBitrate, getVideoBitrate in profit of the Representations lock APIs
  • Remove track preferences API (methods: getPreferredAudioTracks, getPreferredVideoTracks, setPreferredAudioTracks and setPreferredVideoTracks, types: IAudioTrackPreference, ITextTrackPreference and IVideoTrackPreference)
    in profit of the new tracks API
  • Remove audioBitrateChange and videoBitrateChange API in profit of audioRepresenIDtationChange and videoRepresentationChange events
  • Remove availableAudioBitratesChange and availableVideoBitratesChange events. Those are less needed with the new Representations lock API and can be more or less replicated through the audioTrackChange and videoTrackChange events
  • Remove environment variables linked to personalized builds (e.g. RXP_DASH) in profit of the minimal RxPlayer (and remove the usage of those in the code, to remove ugly build scripts)
  • ([V4] DRM: Remove persistentLicense keySystems option and rename licenseStorage to persistentLicenseConfig #1147) Rename IPersistentSessionStorage type to IPersistentLicenseConfig
  • ([V4] Various DRM-related API updates #1148) Remove distinctiveIdentifierRequired API, in profit of the more powerful distinctiveIdentifier API
  • ([V4] Various DRM-related API updates #1148) Remove persistentStateRequired API, in profit of the more powerful persistentState API
  • ([V4] Various DRM-related API updates #1148) Remove keySystems[].onKeyStatusesChange API as it seems to never be used
  • ([V4] Various DRM-related API updates #1148) Remove undocumented audioRobustnesses and videoRobustnesses properties of the keySystems option of loadVideo calls, as more powerful solutions now exist: respectively audioCapabilitiesConfig and videoCapabilitiesConfig
  • ([V4] Flatten transportOptions loadVideo option #1149) "flatten" the transportOptions loadVideo options by putting all its inner properties directly at the top level

Features

  • setAudioTrack, setVideoTrack and setTextTrack now may take an object in argument, with the track's id set as a trackId property, to allow new features
  • Add switchingMode optional property to setVideoTrack and setAudioTrack
  • Add optional periodId property to setAudioTrack, setVideoTrack and setTextTrack
  • getAvailableAudioTracks, getAvailableTextTracks, getAvailableVideoTracks, getAudioTrack, getTextTrack and getVideoTrack can now optionally take a periodId argument to retrieve track information on a specific Period
  • disableTextTrack, anddisableVideoTrack can now optionally take a periodId argument to disable a track for a specific Period
  • Add optional lockedRepresentations property to setAudioTrack and setVideoTrack
  • Add getCurrentPeriod method to retrieve information on the Period currently played
  • Add getAvailablePeriods method to retrieve information on all Periods on which a track or Representation choice can be made
  • Add lockVideoRepresentations, lockAudioRepresentations, getLockedVideoRepresentations, getLockedAudioRepresentations, unlockVideoRepresentations and unlockAudioRepresentations methods to allow a complex selection of Representation
  • ([V4] Remove all bitrate-based API #1144) Add getVideoRepresentation and getAudioRepresentation method to retrieve information on the currently loaded representations
  • Add getContentUrls allowing to retrieve the one or several known URLs through which the current Manifest or content is reachable.
  • Add newAvailablePeriods event to signal new Period on which a track and/or Representation choice can be made
  • Add brokenRepresentationsLock event for when a Representations lock could not be respected anymore
  • Add autoTrackSwitch event for when a chosen track could not be kept by the RxPlayer
  • Add ISegmentLoaderContext public type for the first argument of the segmentLoader API
  • Add IRepresentationFilterRepresentation public type for the first argument of the representationFilter API
  • Add IRepresentationContext public type for the second argument of the representationFilter API
  • Add IManifestLoaderInfo public type for the first argument of the manifestLoader API
  • Add IPeriodChangeEvent public type to define the properties send through a periodChange event
  • Add IPeriod public type to define a Period object returned by methods like getAvailablePeriods or getCurrentPeriod
  • Add IVideoTrackSwitchingMode public type to define the type of the switchingMode property optionally given to setAudioTrack
  • Add IAudioRepresentationsSwitchingMode public type to define the type of the switchingMode property optionally given to lockAudioRepresentations
  • Add IVideoRepresentationsSwitchingMode public type to define the type of the switchingMode property optionally given to lockAudioRepresentations
  • Add IBrokenRepresentationsLockContext public type to define the type sent as a payload of the brokenRepresentationsLock event
  • Add IAutoTrackSwitchEventPayload public type to define the type sent as a payload of the autoTrackSwitch event
  • Add ILockedVideoRepresentationsSettings public type to define the object that should be given to the new lockVideoRepresentation method
  • Add ILockedAudioRepresentationsSettings public type to define the object that should be given to the new lockAudioRepresentation method
  • Add IAudioTrackSetting public type to define the object that may be given to the setAudioTrack method
  • Add IVideoTrackSetting public type to define the object that may be given to the setVideoTrack method
  • Add ITextTrackSetting public type to define the object that may be given to the setTextTrack method
  • ([V4] Various DRM-related API updates #1148) Add distinctiveIdentifier property in the keySystems option (given to the loadVideo method) to have full control over the MediaKeySystemConfiguration of the same name in the chosen key system
  • ([V4] Various DRM-related API updates #1148) Add persistentState property in the keySystems option (given to the loadVideo method) to have full control over the MediaKeySystemConfiguration of the same name in the chosen key system
  • ([V4] Various DRM-related API updates #1148) Add audioCapabilitiesConfig and videoCapabilitiesConfig properties in the keySystems option (given to the loadVideo method) to allow advanced configuration of respectively the "audioCapabilities" and "videoCapabilities" in the asked MediaKeySystemConfiguration

Pending

  • Remove keySystems[].fallbackOn loadVideo option in profit of more configurable keySystems[].onKeyOutputRestricted and keySystems[].onKeyInternalError options?
  • LogLevel only accessible through import of "rx-player/log"?
  • Manage xlinks in the manifestLoader in some ways?
  • Adapt custom segmentLoader to low-latency
    -> for now: another segment loader for low-latency only
@peaBerberian peaBerberian added this to the 4.0.0 milestone Feb 19, 2021
@peaBerberian peaBerberian added API Relative to the RxPlayer's API v4.0.0 Candidate PR/issue for a v4.0.0 release labels Feb 19, 2021
@tykus160
Copy link

Hey. Do you have any ETA for v4 release? I see a lot of movement on linked branch recently, but no announcement yet. Additionally, what is your plan for maintaining v3?

@peaBerberian
Copy link
Collaborator Author

Hi @tykus160,

The first beta version is very imminent, we could have released it today but we saw some missed opportunity which has postponed it at either tomorrow or next week.

We plan to stay as a beta for many months, giving time to applications to make remarks and suggestions. In the meantime, we'll continue to update the v3 as usual. A v3.30.0 for example is still scheduled to be released after the v4 beta.

The v3 should still be maintained for a long time though I have no real timeline to give you here. It will depend on if it appears to be still used (we know even of an application at Canal+ which may not have the resources to make the v4 switch for the foreseeable future, so even only for them we may need to continue making some evolution to it), on issues open relative to the v3, and so on.

In any case, the v3 stays the main version as long as we're still in a v4 beta phase and even after, we don't want to alienate our user base so we'll still maintain it, though of course we prefer if applications made the switch when the first stable v4.0,0 is released.

@peaBerberian
Copy link
Collaborator Author

The first v4 beta release has now been done:
https://github.com/canalplus/rx-player/releases/tag/v4.0.0-beta.0

Don't hesitate to open issues if you have remarks or questions about it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Relative to the RxPlayer's API v4.0.0 Candidate PR/issue for a v4.0.0 release
Projects
None yet
2 participants