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

Refactor how the player is started or changed #7673

Open
litetex opened this issue Jan 20, 2022 · 2 comments
Open

Refactor how the player is started or changed #7673

litetex opened this issue Jan 20, 2022 · 2 comments
Labels
codequality Improvements to the codebase to improve the code quality help wanted Help is wanted in fixing this issue player Issues related to any player (main, popup and background) rewrite Issues and PRs related to rewrite

Comments

@litetex
Copy link
Member

litetex commented Jan 20, 2022

The player intent handling needs major refactoring as it's currently unmanageable - and when bugs occur unfixable (#7427)

Occasions where the player is changed or started

Summarized call hierarchy:

grafik

or as plain text:

NavigationHelper.getPlayerIntent(Context, Class<T>, PlayQueue, boolean, boolean)  (org.schabi.newpipe.util)
    VideoDetailFragment.openMainPlayer()  (org.schabi.newpipe.fragments.detail)
        VideoDetailFragment.openVideoPlayer(boolean)  (org.schabi.newpipe.fragments.detail)
            VideoDetailFragment.openVideoPlayerAutoFullscreen()  (org.schabi.newpipe.fragments.detail)
                VideoDetailFragment.onServiceConnected(Player, MainPlayer, boolean)  (org.schabi.newpipe.fragments.detail)
                    PlayerHolder.setListener(PlayerServiceExtendedEventListener)  (org.schabi.newpipe.player.helper)
                    PlayerServiceConnection in PlayerHolder.onServiceConnected(ComponentName, IBinder)  (org.schabi.newpipe.player.helper)
                VideoDetailFragment.runWorker(boolean, boolean)  (org.schabi.newpipe.fragments.detail)
                    VideoDetailFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.detail)
                    VideoDetailFragment.startLoading(boolean, boolean)  (org.schabi.newpipe.fragments.detail)
                VideoDetailFragment.onClick(View)  (org.schabi.newpipe.fragments.detail)
                    Anonymous in ActionBarDrawerToggle() in ActionBarDrawerToggle.onClick(View)  (androidx.appcompat.app)
                    ClickInterceptSpinner.performClick()  (com.android.printspooler.widget)
                    SearchView.onSearchClicked()  (android.widget)
                    QSFooterImpl.performAccessibilityAction(int, Bundle)  (com.android.systemui.qs)
                    Anonymous in onCreateView() in MaterialDatePicker.onClick(View)  (com.google.android.material.datepicker)
                    SearchView.onSearchClicked()  (androidx.appcompat.widget)
                    Anonymous in onCreateView() in MaterialTimePicker.onClick(View)  (com.google.android.material.timepicker)
                    TextActionModeCallback in Editor.onAssistMenuItemClicked(MenuItem)  (android.widget)
                    AccessibilityTargetHelper.createEnableDialogContentView(Context, AccessibilityServiceTarget, OnClickListener, OnClickListener)(2 usages)  (com.android.internal.accessibility.dialog)
                    KeyButtonView.onTouchEvent(MotionEvent)  (com.android.systemui.statusbar.policy)
                    Anonymous in mOnClickListener in FragmentBreadCrumbs.onClick(View)  (android.app)
                    View.callOnClick()  (android.view)
                    Anonymous in setAction() in Snackbar.onClick(View)  (com.google.android.material.snackbar)
                    RequireScrollMixinTest.testCreateOnClickListener()(2 usages)  (com.android.setupwizardlib.template)
                    TunerZenModePanel.onClick(View)  (com.android.systemui.tuner)
                    Chip.performCloseIconClick()  (com.google.android.material.chip)
                    View.performClick()  (android.view)
                    Anonymous in createOnClickListener() in RequireScrollMixin.onClick(View)  (com.android.setupwizardlib.template)
                    PassThroughClickListener in AutoCompleteTextView.onClick(View)  (android.widget)
                    PhotoView.onSingleTapConfirmed(MotionEvent)  (com.android.ex.photo.views)
                    Anonymous in onCreateView() in MaterialTimePicker.onClick(View)  (com.google.android.material.timepicker)
                    DelayedOnClickListener in SmartReplyView.onClick(View)  (com.android.systemui.statusbar.policy)
            NavigationHelper.openVideoDetailFragment(Context, FragmentManager, int, String, String, PlayQueue, boolean)  (org.schabi.newpipe.util)
                NavigationHelper.playOnMainPlayer(AppCompatActivity, PlayQueue)  (org.schabi.newpipe.util)
                    LocalPlaylistFragment.handleResult(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
                    StatisticsPlaylistFragment.handleResult(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
                    ChannelFragment.handleResult(ChannelInfo)  (org.schabi.newpipe.fragments.list.channel)
                    PlaylistFragment.handleResult(PlaylistInfo)  (org.schabi.newpipe.fragments.list.playlist)
                MainActivity.handleIntent(Intent)  (org.schabi.newpipe)
                    MainActivity.initFragments()  (org.schabi.newpipe)
                    MainActivity.onNewIntent(Intent)  (org.schabi.newpipe)
                Anonymous in initListeners() in LocalPlaylistFragment.selected(LocalItem)  (org.schabi.newpipe.local.playlist)
                    BaseFragment.onViewCreated(View, Bundle)  (org.schabi.newpipe)
                    FeedFragment.initListeners()  (org.schabi.newpipe.local.feed)
                VideoDetailFragment.onActivityResult(int, int, Intent)  (org.schabi.newpipe.fragments.detail)
                    Anonymous in attachController() in FragmentManager.onActivityResult(ActivityResult)  (androidx.fragment.app)
                    Anonymous in attachController() in FragmentManager.onActivityResult(ActivityResult)  (androidx.fragment.app)
                Anonymous in initListeners() in StatisticsPlaylistFragment.selected(LocalItem)  (org.schabi.newpipe.local.history)
                    BaseFragment.onViewCreated(View, Bundle)  (org.schabi.newpipe)
                    FeedFragment.initListeners()  (org.schabi.newpipe.local.feed)
                Anonymous in FeedFragment.kt.onItemClick(Item, View)  (org.schabi.newpipe.local.feed)
                BaseListFragment.onStreamSelected(StreamInfoItem)  (org.schabi.newpipe.fragments.list)
                    Anonymous in initListeners() in BaseListFragment.selected(StreamInfoItem)  (org.schabi.newpipe.fragments.list)
            VideoDetailFragment.onClick(View)  (org.schabi.newpipe.fragments.detail)
                Anonymous in ActionBarDrawerToggle() in ActionBarDrawerToggle.onClick(View)  (androidx.appcompat.app)
                ClickInterceptSpinner.performClick()  (com.android.printspooler.widget)
                SearchView.onSearchClicked()  (android.widget)
                QSFooterImpl.performAccessibilityAction(int, Bundle)  (com.android.systemui.qs)
                Anonymous in onCreateView() in MaterialDatePicker.onClick(View)  (com.google.android.material.datepicker)
                SearchView.onSearchClicked()  (androidx.appcompat.widget)
                TextActionModeCallback in Editor.onAssistMenuItemClicked(MenuItem)  (android.widget)
                Anonymous in onCreateView() in MaterialTimePicker.onClick(View)  (com.google.android.material.timepicker)
                AccessibilityTargetHelper.createEnableDialogContentView(Context, AccessibilityServiceTarget, OnClickListener, OnClickListener)(2 usages)  (com.android.internal.accessibility.dialog)
                KeyButtonView.onTouchEvent(MotionEvent)  (com.android.systemui.statusbar.policy)
                Anonymous in mOnClickListener in FragmentBreadCrumbs.onClick(View)  (android.app)
                View.callOnClick()  (android.view)
                Anonymous in setAction() in Snackbar.onClick(View)  (com.google.android.material.snackbar)
                RequireScrollMixinTest.testCreateOnClickListener()(2 usages)  (com.android.setupwizardlib.template)
                TunerZenModePanel.onClick(View)  (com.android.systemui.tuner)
                Chip.performCloseIconClick()  (com.google.android.material.chip)
                PassThroughClickListener in AutoCompleteTextView.onClick(View)  (android.widget)
                View.performClick()  (android.view)
                Anonymous in createOnClickListener() in RequireScrollMixin.onClick(View)  (com.android.setupwizardlib.template)
                PhotoView.onSingleTapConfirmed(MotionEvent)  (com.android.ex.photo.views)
                Anonymous in onCreateView() in MaterialTimePicker.onClick(View)  (com.google.android.material.timepicker)
                DelayedOnClickListener in SmartReplyView.onClick(View)  (com.android.systemui.statusbar.policy)
NavigationHelper.getPlayerEnqueueIntent(Context, Class<T>, PlayQueue)  (org.schabi.newpipe.util)
    NavigationHelper.enqueueOnPlayer(Context, PlayQueue, PlayerType)  (org.schabi.newpipe.util)
        LocalPlaylistFragment.handleResult(List<PlaylistStreamEntry>)(2 usages)  (org.schabi.newpipe.local.playlist)
            SearchFragment.handleResult(SearchInfo)  (org.schabi.newpipe.fragments.list.search)
            BaseListInfoFragment.handleResult(I)  (org.schabi.newpipe.fragments.list)
            SubscriptionFragment.handleResult(SubscriptionState)  (org.schabi.newpipe.local.subscription)
            VideoDetailFragment.prepareAndHandleInfo(StreamInfo, boolean)  (org.schabi.newpipe.fragments.detail)
            Anonymous in getPlaylistsSubscriber() in BookmarkFragment.onNext(List<PlaylistLocalItem>)  (org.schabi.newpipe.local.bookmark)
            BaseListInfoFragment.doInitialLoadLogic()  (org.schabi.newpipe.fragments.list)
            KioskFragment.handleResult(KioskInfo)  (org.schabi.newpipe.fragments.list.kiosk)
            PlaylistFragment.handleResult(PlaylistInfo)  (org.schabi.newpipe.fragments.list.playlist)
            FeedFragment.onResume()  (org.schabi.newpipe.local.feed)
            Anonymous in getHistoryObserver() in StatisticsPlaylistFragment.onNext(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
            FeedFragment.onViewCreated(View, Bundle)  (org.schabi.newpipe.local.feed)
            BaseListInfoFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list)
            RelatedItemsFragment.handleResult(RelatedItemInfo)  (org.schabi.newpipe.fragments.list.videos)
            Anonymous in getPlaylistObserver() in LocalPlaylistFragment.onNext(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
            VideoDetailFragment.runWorker(boolean, boolean)  (org.schabi.newpipe.fragments.detail)
            ChannelFragment.handleResult(ChannelInfo)  (org.schabi.newpipe.fragments.list.channel)
            CommentsFragment.handleResult(CommentsInfo)  (org.schabi.newpipe.fragments.list.comments)
            SearchFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list.search)
            SubscriptionFragment.initViews(View, Bundle)  (org.schabi.newpipe.local.subscription)
        ChannelFragment.handleResult(ChannelInfo)(2 usages)  (org.schabi.newpipe.fragments.list.channel)
            SubscriptionFragment.handleResult(SubscriptionState)  (org.schabi.newpipe.local.subscription)
            VideoDetailFragment.prepareAndHandleInfo(StreamInfo, boolean)  (org.schabi.newpipe.fragments.detail)
            BookmarkFragment.handleResult(List<PlaylistLocalItem>)  (org.schabi.newpipe.local.bookmark)
            StatisticsPlaylistFragment.handleResult(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
            Anonymous in getPlaylistsSubscriber() in BookmarkFragment.onNext(List<PlaylistLocalItem>)  (org.schabi.newpipe.local.bookmark)
            BaseListInfoFragment.doInitialLoadLogic()  (org.schabi.newpipe.fragments.list)
            FeedFragment.onResume()  (org.schabi.newpipe.local.feed)
            Anonymous in getHistoryObserver() in StatisticsPlaylistFragment.onNext(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
            FeedFragment.onViewCreated(View, Bundle)  (org.schabi.newpipe.local.feed)
            BaseListInfoFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list)
            VideoDetailFragment.runWorker(boolean, boolean)  (org.schabi.newpipe.fragments.detail)
            Anonymous in getPlaylistObserver() in LocalPlaylistFragment.onNext(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
            LocalPlaylistFragment.handleResult(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
            SearchFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list.search)
            SubscriptionFragment.initViews(View, Bundle)  (org.schabi.newpipe.local.subscription)
        VideoDetailFragment.openNormalBackgroundPlayer(boolean)  (org.schabi.newpipe.fragments.detail)
            VideoDetailFragment.openBackgroundPlayer(boolean)  (org.schabi.newpipe.fragments.detail)
        NavigationHelper.enqueueOnPlayer(Context, PlayQueue)  (org.schabi.newpipe.util)
            StreamDialogEntry.enqueue  (org.schabi.newpipe.util)
        VideoDetailFragment.openPopupPlayer(boolean)  (org.schabi.newpipe.fragments.detail)
            VideoDetailFragment.onLongClick(View)  (org.schabi.newpipe.fragments.detail)
            VideoDetailFragment.onClick(View)  (org.schabi.newpipe.fragments.detail)
        PlaylistFragment.handleResult(PlaylistInfo)(2 usages)  (org.schabi.newpipe.fragments.list.playlist)
            SubscriptionFragment.handleResult(SubscriptionState)  (org.schabi.newpipe.local.subscription)
            VideoDetailFragment.prepareAndHandleInfo(StreamInfo, boolean)  (org.schabi.newpipe.fragments.detail)
            BookmarkFragment.handleResult(List<PlaylistLocalItem>)  (org.schabi.newpipe.local.bookmark)
            StatisticsPlaylistFragment.handleResult(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
            Anonymous in getPlaylistsSubscriber() in BookmarkFragment.onNext(List<PlaylistLocalItem>)  (org.schabi.newpipe.local.bookmark)
            BaseListInfoFragment.doInitialLoadLogic()  (org.schabi.newpipe.fragments.list)
            FeedFragment.onResume()  (org.schabi.newpipe.local.feed)
            FeedFragment.onViewCreated(View, Bundle)  (org.schabi.newpipe.local.feed)
            Anonymous in getHistoryObserver() in StatisticsPlaylistFragment.onNext(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
            BaseListInfoFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list)
            Anonymous in getPlaylistObserver() in LocalPlaylistFragment.onNext(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
            VideoDetailFragment.runWorker(boolean, boolean)  (org.schabi.newpipe.fragments.detail)
            LocalPlaylistFragment.handleResult(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
            SearchFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list.search)
            SubscriptionFragment.initViews(View, Bundle)  (org.schabi.newpipe.local.subscription)
NavigationHelper.playOnBackgroundPlayer(Context, PlayQueue, boolean)  (org.schabi.newpipe.util)
    PlaylistFragment.showStreamDialog(StreamInfoItem)  (org.schabi.newpipe.fragments.list.playlist)
        Anonymous in initListeners() in BaseListFragment.held(StreamInfoItem)  (org.schabi.newpipe.fragments.list)
    StatisticsPlaylistFragment.showStreamDialog(StreamStatisticsEntry)  (org.schabi.newpipe.local.history)
        Anonymous in initListeners() in StatisticsPlaylistFragment.held(LocalItem)  (org.schabi.newpipe.local.history)
    FetcherService in RouterActivity.getResultHandler(Choice)  (org.schabi.newpipe)
        FetcherService in RouterActivity.handleChoice(Choice)  (org.schabi.newpipe)
    LocalPlaylistFragment.handleResult(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
        SearchFragment.handleResult(SearchInfo)  (org.schabi.newpipe.fragments.list.search)
        BaseListInfoFragment.handleResult(I)  (org.schabi.newpipe.fragments.list)
        SubscriptionFragment.handleResult(SubscriptionState)  (org.schabi.newpipe.local.subscription)
        VideoDetailFragment.prepareAndHandleInfo(StreamInfo, boolean)  (org.schabi.newpipe.fragments.detail)
        Anonymous in getPlaylistsSubscriber() in BookmarkFragment.onNext(List<PlaylistLocalItem>)  (org.schabi.newpipe.local.bookmark)
        BaseListInfoFragment.doInitialLoadLogic()  (org.schabi.newpipe.fragments.list)
        PlaylistFragment.handleResult(PlaylistInfo)  (org.schabi.newpipe.fragments.list.playlist)
        KioskFragment.handleResult(KioskInfo)  (org.schabi.newpipe.fragments.list.kiosk)
        FeedFragment.onResume()  (org.schabi.newpipe.local.feed)
        FeedFragment.onViewCreated(View, Bundle)  (org.schabi.newpipe.local.feed)
        Anonymous in getHistoryObserver() in StatisticsPlaylistFragment.onNext(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
        BaseListInfoFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list)
        RelatedItemsFragment.handleResult(RelatedItemInfo)  (org.schabi.newpipe.fragments.list.videos)
        Anonymous in getPlaylistObserver() in LocalPlaylistFragment.onNext(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
        VideoDetailFragment.runWorker(boolean, boolean)  (org.schabi.newpipe.fragments.detail)
        CommentsFragment.handleResult(CommentsInfo)  (org.schabi.newpipe.fragments.list.comments)
        ChannelFragment.handleResult(ChannelInfo)  (org.schabi.newpipe.fragments.list.channel)
        SearchFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list.search)
        SubscriptionFragment.initViews(View, Bundle)  (org.schabi.newpipe.local.subscription)
    StreamDialogEntry.start_here_on_background  (org.schabi.newpipe.util)
        BaseListFragment.showStreamDialog(StreamInfoItem)  (org.schabi.newpipe.fragments.list)
        BaseListFragment.showStreamDialog(StreamInfoItem)  (org.schabi.newpipe.fragments.list)
        StatisticsPlaylistFragment.showStreamDialog(StreamStatisticsEntry)  (org.schabi.newpipe.local.history)
        LocalPlaylistFragment.showStreamItemDialog(PlaylistStreamEntry)  (org.schabi.newpipe.local.playlist)
        LocalPlaylistFragment.showStreamItemDialog(PlaylistStreamEntry)  (org.schabi.newpipe.local.playlist)
        StatisticsPlaylistFragment.showStreamDialog(StreamStatisticsEntry)  (org.schabi.newpipe.local.history)
        StatisticsPlaylistFragment.showStreamDialog(StreamStatisticsEntry)  (org.schabi.newpipe.local.history)
        LocalPlaylistFragment.showStreamItemDialog(PlaylistStreamEntry)  (org.schabi.newpipe.local.playlist)
        [Invalid]
        PlaylistFragment.showStreamDialog(StreamInfoItem)  (org.schabi.newpipe.fragments.list.playlist)
        PlaylistFragment.showStreamDialog(StreamInfoItem)  (org.schabi.newpipe.fragments.list.playlist)
        [Invalid]
        PlaylistFragment.showStreamDialog(StreamInfoItem)  (org.schabi.newpipe.fragments.list.playlist)
    StatisticsPlaylistFragment.handleResult(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
        SearchFragment.handleResult(SearchInfo)  (org.schabi.newpipe.fragments.list.search)
        BaseListInfoFragment.handleResult(I)  (org.schabi.newpipe.fragments.list)
        SubscriptionFragment.handleResult(SubscriptionState)  (org.schabi.newpipe.local.subscription)
        VideoDetailFragment.prepareAndHandleInfo(StreamInfo, boolean)  (org.schabi.newpipe.fragments.detail)
        Anonymous in getPlaylistsSubscriber() in BookmarkFragment.onNext(List<PlaylistLocalItem>)  (org.schabi.newpipe.local.bookmark)
        BaseListInfoFragment.doInitialLoadLogic()  (org.schabi.newpipe.fragments.list)
        PlaylistFragment.handleResult(PlaylistInfo)  (org.schabi.newpipe.fragments.list.playlist)
        KioskFragment.handleResult(KioskInfo)  (org.schabi.newpipe.fragments.list.kiosk)
        FeedFragment.onResume()  (org.schabi.newpipe.local.feed)
        Anonymous in getHistoryObserver() in StatisticsPlaylistFragment.onNext(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
        FeedFragment.onViewCreated(View, Bundle)  (org.schabi.newpipe.local.feed)
        BaseListInfoFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list)
        RelatedItemsFragment.handleResult(RelatedItemInfo)  (org.schabi.newpipe.fragments.list.videos)
        Anonymous in getPlaylistObserver() in LocalPlaylistFragment.onNext(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
        VideoDetailFragment.runWorker(boolean, boolean)  (org.schabi.newpipe.fragments.detail)
        ChannelFragment.handleResult(ChannelInfo)  (org.schabi.newpipe.fragments.list.channel)
        CommentsFragment.handleResult(CommentsInfo)  (org.schabi.newpipe.fragments.list.comments)
        SearchFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list.search)
        SubscriptionFragment.initViews(View, Bundle)  (org.schabi.newpipe.local.subscription)
    ChannelFragment.handleResult(ChannelInfo)  (org.schabi.newpipe.fragments.list.channel)
        SubscriptionFragment.handleResult(SubscriptionState)  (org.schabi.newpipe.local.subscription)
        BookmarkFragment.handleResult(List<PlaylistLocalItem>)  (org.schabi.newpipe.local.bookmark)
        VideoDetailFragment.prepareAndHandleInfo(StreamInfo, boolean)  (org.schabi.newpipe.fragments.detail)
        StatisticsPlaylistFragment.handleResult(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
        Anonymous in getPlaylistsSubscriber() in BookmarkFragment.onNext(List<PlaylistLocalItem>)  (org.schabi.newpipe.local.bookmark)
        BaseListInfoFragment.doInitialLoadLogic()  (org.schabi.newpipe.fragments.list)
        FeedFragment.onResume()  (org.schabi.newpipe.local.feed)
        Anonymous in getHistoryObserver() in StatisticsPlaylistFragment.onNext(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
        FeedFragment.onViewCreated(View, Bundle)  (org.schabi.newpipe.local.feed)
        BaseListInfoFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list)
        Anonymous in getPlaylistObserver() in LocalPlaylistFragment.onNext(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
        VideoDetailFragment.runWorker(boolean, boolean)  (org.schabi.newpipe.fragments.detail)
        LocalPlaylistFragment.handleResult(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
        SearchFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list.search)
        SubscriptionFragment.initViews(View, Bundle)  (org.schabi.newpipe.local.subscription)
    LocalPlaylistFragment.showStreamItemDialog(PlaylistStreamEntry)  (org.schabi.newpipe.local.playlist)
        Anonymous in initListeners() in LocalPlaylistFragment.held(LocalItem)  (org.schabi.newpipe.local.playlist)
    PlayQueueActivity.onOptionsItemSelected(MenuItem)  (org.schabi.newpipe.player)
        PreferenceActivity.onOptionsItemSelected(MenuItem)  (android.preference)
        Activity.onMenuItemSelected(int, MenuItem)  (android.app)
        Activity.onOptionsItemSelected(MenuItem)  (android.app)
        NavigatingActivity.onOptionsItemSelected(MenuItem)  (leakcanary.internal.navigation)
        AboutActivity.onOptionsItemSelected(MenuItem)  (org.schabi.newpipe.about)
    VideoDetailFragment.openNormalBackgroundPlayer(boolean)  (org.schabi.newpipe.fragments.detail)
        VideoDetailFragment.openBackgroundPlayer(boolean)  (org.schabi.newpipe.fragments.detail)
    PlaylistFragment.handleResult(PlaylistInfo)  (org.schabi.newpipe.fragments.list.playlist)
        SubscriptionFragment.handleResult(SubscriptionState)  (org.schabi.newpipe.local.subscription)
        BookmarkFragment.handleResult(List<PlaylistLocalItem>)  (org.schabi.newpipe.local.bookmark)
        VideoDetailFragment.prepareAndHandleInfo(StreamInfo, boolean)  (org.schabi.newpipe.fragments.detail)
        StatisticsPlaylistFragment.handleResult(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
        Anonymous in getPlaylistsSubscriber() in BookmarkFragment.onNext(List<PlaylistLocalItem>)  (org.schabi.newpipe.local.bookmark)
        BaseListInfoFragment.doInitialLoadLogic()  (org.schabi.newpipe.fragments.list)
        FeedFragment.onResume()  (org.schabi.newpipe.local.feed)
        Anonymous in getHistoryObserver() in StatisticsPlaylistFragment.onNext(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
        FeedFragment.onViewCreated(View, Bundle)  (org.schabi.newpipe.local.feed)
        BaseListInfoFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list)
        Anonymous in getPlaylistObserver() in LocalPlaylistFragment.onNext(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
        VideoDetailFragment.runWorker(boolean, boolean)  (org.schabi.newpipe.fragments.detail)
        LocalPlaylistFragment.handleResult(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
        SearchFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list.search)
        SubscriptionFragment.initViews(View, Bundle)  (org.schabi.newpipe.local.subscription)
NotificationUtil.getIntentForNotification(Player)  (org.schabi.newpipe.player)
    NotificationUtil.updateNotification(Player)  (org.schabi.newpipe.player)
        NotificationUtil.createNotificationIfNeededAndUpdate(Player, boolean)  (org.schabi.newpipe.player)
            Player.onPlayQueueEdited()  (org.schabi.newpipe.player)
            Player.onShuffleOrRepeatModeChanged()  (org.schabi.newpipe.player)
            Player.onMetadataChanged(MediaSourceTag)  (org.schabi.newpipe.player)
            Player.onPlaying()  (org.schabi.newpipe.player)
            Player.onBroadcastReceived(Intent)  (org.schabi.newpipe.player)
            Anonymous in initThumbnail() in Player.onBitmapFailed(Exception, Drawable)  (org.schabi.newpipe.player)
            Player.onBuffering()  (org.schabi.newpipe.player)
            Player.onTimelineChanged(Timeline, int)  (org.schabi.newpipe.player)
            Player.onBlocked()  (org.schabi.newpipe.player)
            Anonymous in initThumbnail() in Player.onBitmapLoaded(Bitmap, LoadedFrom)  (org.schabi.newpipe.player)
            Player.onPaused()  (org.schabi.newpipe.player)
            Player.onPausedSeek()  (org.schabi.newpipe.player)
            Player.onCompleted()  (org.schabi.newpipe.player)
        NotificationUtil.createNotificationAndStartForeground(Player, Service)  (org.schabi.newpipe.player)
            MainPlayer.createView()  (org.schabi.newpipe.player)
            MainPlayer.onStartCommand(Intent, int, int)  (org.schabi.newpipe.player)
NavigationHelper.getPlayerEnqueueNextIntent(Context, Class<T>, PlayQueue)  (org.schabi.newpipe.util)
    NavigationHelper.enqueueNextOnPlayer(Context, PlayQueue)  (org.schabi.newpipe.util)
        StreamDialogEntry.enqueue_next  (org.schabi.newpipe.util)
            PlaylistFragment.showStreamDialog(StreamInfoItem)  (org.schabi.newpipe.fragments.list.playlist)
                Anonymous in initListeners() in BaseListFragment.held(StreamInfoItem)  (org.schabi.newpipe.fragments.list)
            LocalPlaylistFragment.showStreamItemDialog(PlaylistStreamEntry)  (org.schabi.newpipe.local.playlist)
                Anonymous in initListeners() in LocalPlaylistFragment.held(LocalItem)  (org.schabi.newpipe.local.playlist)
            StatisticsPlaylistFragment.showStreamDialog(StreamStatisticsEntry)  (org.schabi.newpipe.local.history)
                Anonymous in initListeners() in StatisticsPlaylistFragment.held(LocalItem)  (org.schabi.newpipe.local.history)
            BaseListFragment.showStreamDialog(StreamInfoItem)  (org.schabi.newpipe.fragments.list)
                Anonymous in initListeners() in BaseListFragment.held(StreamInfoItem)  (org.schabi.newpipe.fragments.list)
            [Invalid]
NavigationHelper.playOnPopupPlayer(Context, PlayQueue, boolean)  (org.schabi.newpipe.util)
    Player.onFragmentStopped()  (org.schabi.newpipe.player)
        Player.onBroadcastReceived(Intent)(2 usages)  (org.schabi.newpipe.player)
    FetcherService in RouterActivity.getResultHandler(Choice)  (org.schabi.newpipe)
        FetcherService in RouterActivity.handleChoice(Choice)  (org.schabi.newpipe)
    LocalPlaylistFragment.handleResult(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
        SearchFragment.handleResult(SearchInfo)  (org.schabi.newpipe.fragments.list.search)
        BaseListInfoFragment.handleResult(I)  (org.schabi.newpipe.fragments.list)
        SubscriptionFragment.handleResult(SubscriptionState)  (org.schabi.newpipe.local.subscription)
        VideoDetailFragment.prepareAndHandleInfo(StreamInfo, boolean)  (org.schabi.newpipe.fragments.detail)
        Anonymous in getPlaylistsSubscriber() in BookmarkFragment.onNext(List<PlaylistLocalItem>)  (org.schabi.newpipe.local.bookmark)
        BaseListInfoFragment.doInitialLoadLogic()  (org.schabi.newpipe.fragments.list)
        KioskFragment.handleResult(KioskInfo)  (org.schabi.newpipe.fragments.list.kiosk)
        PlaylistFragment.handleResult(PlaylistInfo)  (org.schabi.newpipe.fragments.list.playlist)
        FeedFragment.onResume()  (org.schabi.newpipe.local.feed)
        FeedFragment.onViewCreated(View, Bundle)  (org.schabi.newpipe.local.feed)
        Anonymous in getHistoryObserver() in StatisticsPlaylistFragment.onNext(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
        BaseListInfoFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list)
        RelatedItemsFragment.handleResult(RelatedItemInfo)  (org.schabi.newpipe.fragments.list.videos)
        Anonymous in getPlaylistObserver() in LocalPlaylistFragment.onNext(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
        VideoDetailFragment.runWorker(boolean, boolean)  (org.schabi.newpipe.fragments.detail)
        ChannelFragment.handleResult(ChannelInfo)  (org.schabi.newpipe.fragments.list.channel)
        CommentsFragment.handleResult(CommentsInfo)  (org.schabi.newpipe.fragments.list.comments)
        SearchFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list.search)
        SubscriptionFragment.initViews(View, Bundle)  (org.schabi.newpipe.local.subscription)
    ChannelFragment.handleResult(ChannelInfo)  (org.schabi.newpipe.fragments.list.channel)
        SubscriptionFragment.handleResult(SubscriptionState)  (org.schabi.newpipe.local.subscription)
        VideoDetailFragment.prepareAndHandleInfo(StreamInfo, boolean)  (org.schabi.newpipe.fragments.detail)
        BookmarkFragment.handleResult(List<PlaylistLocalItem>)  (org.schabi.newpipe.local.bookmark)
        StatisticsPlaylistFragment.handleResult(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
        Anonymous in getPlaylistsSubscriber() in BookmarkFragment.onNext(List<PlaylistLocalItem>)  (org.schabi.newpipe.local.bookmark)
        BaseListInfoFragment.doInitialLoadLogic()  (org.schabi.newpipe.fragments.list)
        FeedFragment.onResume()  (org.schabi.newpipe.local.feed)
        Anonymous in getHistoryObserver() in StatisticsPlaylistFragment.onNext(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
        FeedFragment.onViewCreated(View, Bundle)  (org.schabi.newpipe.local.feed)
        BaseListInfoFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list)
        Anonymous in getPlaylistObserver() in LocalPlaylistFragment.onNext(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
        VideoDetailFragment.runWorker(boolean, boolean)  (org.schabi.newpipe.fragments.detail)
        LocalPlaylistFragment.handleResult(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
        SearchFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list.search)
        SubscriptionFragment.initViews(View, Bundle)  (org.schabi.newpipe.local.subscription)
    StatisticsPlaylistFragment.handleResult(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
        SearchFragment.handleResult(SearchInfo)  (org.schabi.newpipe.fragments.list.search)
        BaseListInfoFragment.handleResult(I)  (org.schabi.newpipe.fragments.list)
        SubscriptionFragment.handleResult(SubscriptionState)  (org.schabi.newpipe.local.subscription)
        VideoDetailFragment.prepareAndHandleInfo(StreamInfo, boolean)  (org.schabi.newpipe.fragments.detail)
        Anonymous in getPlaylistsSubscriber() in BookmarkFragment.onNext(List<PlaylistLocalItem>)  (org.schabi.newpipe.local.bookmark)
        BaseListInfoFragment.doInitialLoadLogic()  (org.schabi.newpipe.fragments.list)
        PlaylistFragment.handleResult(PlaylistInfo)  (org.schabi.newpipe.fragments.list.playlist)
        KioskFragment.handleResult(KioskInfo)  (org.schabi.newpipe.fragments.list.kiosk)
        FeedFragment.onResume()  (org.schabi.newpipe.local.feed)
        Anonymous in getHistoryObserver() in StatisticsPlaylistFragment.onNext(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
        FeedFragment.onViewCreated(View, Bundle)  (org.schabi.newpipe.local.feed)
        BaseListInfoFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list)
        RelatedItemsFragment.handleResult(RelatedItemInfo)  (org.schabi.newpipe.fragments.list.videos)
        Anonymous in getPlaylistObserver() in LocalPlaylistFragment.onNext(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
        VideoDetailFragment.runWorker(boolean, boolean)  (org.schabi.newpipe.fragments.detail)
        ChannelFragment.handleResult(ChannelInfo)  (org.schabi.newpipe.fragments.list.channel)
        CommentsFragment.handleResult(CommentsInfo)  (org.schabi.newpipe.fragments.list.comments)
        SearchFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list.search)
        SubscriptionFragment.initViews(View, Bundle)  (org.schabi.newpipe.local.subscription)
    StreamDialogEntry.start_here_on_popup  (org.schabi.newpipe.util)
        BaseListFragment.showStreamDialog(StreamInfoItem)  (org.schabi.newpipe.fragments.list)
        StatisticsPlaylistFragment.showStreamDialog(StreamStatisticsEntry)  (org.schabi.newpipe.local.history)
        LocalPlaylistFragment.showStreamItemDialog(PlaylistStreamEntry)  (org.schabi.newpipe.local.playlist)
        PlaylistFragment.showStreamDialog(StreamInfoItem)  (org.schabi.newpipe.fragments.list.playlist)
        [Invalid]
    PlayQueueActivity.onOptionsItemSelected(MenuItem)  (org.schabi.newpipe.player)
        PreferenceActivity.onOptionsItemSelected(MenuItem)  (android.preference)
        Activity.onMenuItemSelected(int, MenuItem)  (android.app)
        Activity.onOptionsItemSelected(MenuItem)  (android.app)
        NavigatingActivity.onOptionsItemSelected(MenuItem)  (leakcanary.internal.navigation)
        AboutActivity.onOptionsItemSelected(MenuItem)  (org.schabi.newpipe.about)
    VideoDetailFragment.openPopupPlayer(boolean)  (org.schabi.newpipe.fragments.detail)
        VideoDetailFragment.onLongClick(View)  (org.schabi.newpipe.fragments.detail)
        VideoDetailFragment.onClick(View)  (org.schabi.newpipe.fragments.detail)
    PlaylistFragment.handleResult(PlaylistInfo)  (org.schabi.newpipe.fragments.list.playlist)
        SubscriptionFragment.handleResult(SubscriptionState)  (org.schabi.newpipe.local.subscription)
        VideoDetailFragment.prepareAndHandleInfo(StreamInfo, boolean)  (org.schabi.newpipe.fragments.detail)
        BookmarkFragment.handleResult(List<PlaylistLocalItem>)  (org.schabi.newpipe.local.bookmark)
        StatisticsPlaylistFragment.handleResult(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
        Anonymous in getPlaylistsSubscriber() in BookmarkFragment.onNext(List<PlaylistLocalItem>)  (org.schabi.newpipe.local.bookmark)
        BaseListInfoFragment.doInitialLoadLogic()  (org.schabi.newpipe.fragments.list)
        FeedFragment.onResume()  (org.schabi.newpipe.local.feed)
        Anonymous in getHistoryObserver() in StatisticsPlaylistFragment.onNext(List<StreamStatisticsEntry>)  (org.schabi.newpipe.local.history)
        FeedFragment.onViewCreated(View, Bundle)  (org.schabi.newpipe.local.feed)
        BaseListInfoFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list)
        Anonymous in getPlaylistObserver() in LocalPlaylistFragment.onNext(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
        VideoDetailFragment.runWorker(boolean, boolean)  (org.schabi.newpipe.fragments.detail)
        LocalPlaylistFragment.handleResult(List<PlaylistStreamEntry>)  (org.schabi.newpipe.local.playlist)
        SearchFragment.startLoading(boolean)  (org.schabi.newpipe.fragments.list.search)
        SubscriptionFragment.initViews(View, Bundle)  (org.schabi.newpipe.local.subscription)
    InternalUrlsHandler.playOnPopup(Context, String, StreamingService, int, CompositeDisposable)  (org.schabi.newpipe.util.external_communication)
        Anonymous in addClickListenersOnTimestamps() in TextLinkifier.onClick(View)  (org.schabi.newpipe.util.external_communication)
        InternalUrlsHandler.handleUrl(Context, String, Pattern, CompositeDisposable)  (org.schabi.newpipe.util.external_communication)

It would be great

@litetex litetex added player Issues related to any player (main, popup and background) codequality Improvements to the codebase to improve the code quality labels Jan 20, 2022
@opusforlife2 opusforlife2 added the help wanted Help is wanted in fixing this issue label Feb 12, 2022
@Stypox
Copy link
Member

Stypox commented Sep 15, 2022

Here is how I want to restructure the player (service) start/change logic. These static methods should be accessible from anywhere. They should be callable one after the other: for example, if I want to switch the player and enqueue some items, first I call enqueue and then switchPlayer.

  • startPlayer(type, queue, resumePlayback)
    • starts a new player of the specified type
    • resumes the playback of the first item if requested
    • if a player was already open, the following parameters are preserved: playback quality, playback parameters (maybe more)
  • switchPlayer(type)
    • switches the player to the specified type
    • requires the player to be currently open
  • enqueue(queue, mode)
    • appends the provided queue to the currently open player
    • mode can be "bottom" or "next"
    • requires the player to be currently open

I will try to see if all of these actions (except maybe a part of startPlayer) can be performed without using Intents but rather via the player bound to PlayerHolder.

@evermind-zz
Copy link
Contributor

Here is how I want to restructure the player (service) start/change logic. These static methods should be accessible from anywhere. They should be callable one after the other: for example, if I want to switch the player and enqueue some items, first I call enqueue and
...
I will try to see if all of these actions (except maybe a part of startPlayer) can be performed without using Intents but rather via the player bound to PlayerHolder.

What about using a event bus like Greenrobot's EventBus ?

@ShareASmile ShareASmile added the rewrite Issues and PRs related to rewrite label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codequality Improvements to the codebase to improve the code quality help wanted Help is wanted in fixing this issue player Issues related to any player (main, popup and background) rewrite Issues and PRs related to rewrite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants