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

Player model #55

Open
Ivshti opened this issue Jun 6, 2019 · 2 comments
Open

Player model #55

Ivshti opened this issue Jun 6, 2019 · 2 comments
Assignees
Milestone

Comments

@Ivshti
Copy link
Member

Ivshti commented Jun 6, 2019

pub struct PlayerModel {
   // from the router, we will get (item_id, video_id, stream, meta_resourcereq)
   // @TODO maybe an addon transport_url too, there are use cases where we want information from the addon manifest
   // @TODO: Option or Loadable? Cause we may want to express "will not load" vs "loading"
   pub meta: Option<MetaItem>,
   pub next_video: Option<Video>,
   pub libitem: Option<LibItem>, // should we use Loadable? 
   pub stream: Stream,
}

As for handling the bingeing (or other complicated cases), we should:

fn update(&mut self, ctx: &Ctx, action: &Action) {
    match action {
        Msg::Player(item, PlayerEv::Ended) if item == Some(self.libitem) => {
              if let Some(next) = self.next_video && ctx.settings.bingeing  {
                    // trigger an Effect that resolves in Open
              }
        }

By default, the player will try to get an existing item from the library with this ID. If it does not exist, it will construct it from the loaded meta. If that doesn't load, it will operate without a libItem.

All extra roles: bingeing, saving library item state, marking episodes watched, marking notifications seen

It can operate without a libItem (just proxying the Player implementation) or with one, in which case it should load the library item, nad mutate it as the player advances

When the player starts playing it should request subtitles from the addon system and do addExtraSubtitles for each result and perhaps set selected subtitles when applying PlayerPreferences;
also send stream.subtitles via addExtraSubtitles

It should also mutate and persist PlayerPreferences itself, which should contain preferred subtitle language, preferred track for each language, preferred audio track, and subtitles delay

It should also catch and handle internal inconsistencies, most notably the playing stream being different than self.stream

@Ivshti Ivshti added this to the v1.0 milestone Jul 27, 2019
@nklhtv
Copy link
Contributor

nklhtv commented Jun 8, 2022

Some part of the logic is implemented: using the correct library item, binge watching, updating library item state.
The model does not act as a proxy of the player impl as we cannot keep references to ui elements or js objects in core. Instead the ui loads the stream thats currently exported by the player model, and transforms various player impl events into player actions: onEnded, onTimeChange etc.

Player model still needs to:

  • load subtitles using the video hash provided by the player impl (if supported)
  • manage user preferences about subtitles and audio tracks

@elpiel
Copy link
Member

elpiel commented Nov 7, 2023

Video params have been added/changed in #533
Subtitles and audio tracks state tracking has been added in #553

User settings for the audio track language and subtitles language are handled by each application and not in core.
A stream override of these audio and subtitles languages is now implemented in #553

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants