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

Add playback rewrite backend and plugin systems #2401

Merged
merged 7 commits into from
Jan 14, 2023

Conversation

nielsvanvelzen
Copy link
Member

There we go, the second big PR for the playback rewrite! I've spent some time rewriting the core of the rewrite to design an architecture that I felt satisfied with the past few weeks. This PR contains a part of it. Everything related to video is removed and some unstable parts are missing too.

(Not all individual commits build because some of them are missing PlaybackManager)

Changes

  • Add PlaybackManager
    Manages all the playback stuff, should technically support multi-instance but we'll use it single instance for now. Stores the active backend in the PlaybackRepository (name will probably change, implementation is mostly missing because most of it's functionality is video related).

  • Add MediaStreamResolver (currently unused, reserved for a future PR)
    Returns MediaStream's (most implementation is missing because it was still incomplete/non-functional. Only stream URL for now)

  • Add PlayerState
    It contains the current state of playback and contains functions to manipulate the state. This is one of the most important parts of the playback module.

  • Add PlayerBackend & BasePlayerBackend
    Binds to the actual player (ExoPlayer). Emits events that are converted to the PlayerState instance. Plugins should normally not access the backend directly.

  • Add plugins
    A plugin provides various parts to the playback code: backends, services and media stream resolvers. Most plugins will only provide services that work with PlayerState.

  • Queue changes
    Converted to service, some metadata updates

Next PR in another year!

Issues

Part of #1057

@nielsvanvelzen nielsvanvelzen added enhancement New feature or request playback Issue related to media playback labels Jan 10, 2023
@nielsvanvelzen nielsvanvelzen added this to the v0.16.0 milestone Jan 10, 2023
import org.jellyfin.playback.core.plugin.PlaybackPlugin
import org.jellyfin.playback.core.plugin.PlayerService

class PlaybackManagerBuilder() {

Check warning

Code scanning / detekt

Empty block of code detected. As they serve no purpose they should be removed.

An empty default constructor can be removed.
import org.jellyfin.playback.core.PlaybackManager
import org.jellyfin.playback.core.PlayerState

abstract class PlayerService {

Check warning

Code scanning / detekt

An abstract class is unnecessary. May be refactored to an interface or to a concrete class.

An abstract class without an abstract member can be refactored to a concrete class.
class PlaybackManager internal constructor(
val backend: PlayerBackend,
private val services: MutableList<PlayerService>,
private val mediaStreamResolvers: List<MediaStreamResolver>,

Check warning

Code scanning / detekt

Private member is unused and should be removed.

Private property `mediaStreamResolvers` is unused.
@nielsvanvelzen nielsvanvelzen marked this pull request as ready for review January 10, 2023 15:05
@nielsvanvelzen nielsvanvelzen merged commit 48f2503 into jellyfin:master Jan 14, 2023
@nielsvanvelzen nielsvanvelzen deleted the playback-backend branch January 14, 2023 11:48
@nielsvanvelzen nielsvanvelzen mentioned this pull request Jan 30, 2023
35 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request playback Issue related to media playback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant