Skip to content

Add a loading window when loading network resources #5152

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

Merged
merged 7 commits into from
Oct 7, 2024
Merged

Conversation

uiryuu
Copy link
Member

@uiryuu uiryuu commented Aug 20, 2024


Description:
After #5054, the main window will show after the video is loaded by mpv and the video size is available from mpv. Therefore when the user is loading a video from Internet through yt-dlp, nothing will show up until the video is loaded, which will take a considerate amount of time. This PR adds a loading window (which reuses the OpenURLWindow) when opening a URL.

Changes in this PR:

  • Added an overlay view in the OpenURLWindow which works as a loading screen for when loading internet resources
  • Added autosave name for OpenURLWindow
  • When user closes the OpenURLWindow when loading a URL, stop the player core
  • Fixed an issue where the "Unable to open URL" error dialog doesn't popup
    • By changing info.state == .loading to info.state == .starting when deciding whether or not mpv couldn't load the URL
    • @low-batt please confirm whether or not this is the correct fix
  • Improved error handling: if mpv couldn't load the URL and OpenURLWindow is open with the loading screen, OpenURLWindow will change back to normal mode with error message, so that the user can input another URL and try again. See the video below:
Error.handling.-.old.mov
Error.handling.-.new.mov

@uiryuu uiryuu requested a review from low-batt August 20, 2024 07:08
@svobs
Copy link
Contributor

svobs commented Sep 5, 2024

Looks nice! Definitely a good idea.

One request: could there be a "Stop" or "Cancel" button once it starts to load? In case it gets stuck on a bad connection, that would give an impatient user a way out. Would be ideal if it could just show the form again without clearing any of the fields which were filled out.

@uiryuu uiryuu merged commit 03cb41a into develop Oct 7, 2024
1 check passed
@uiryuu uiryuu deleted the loading-window branch October 7, 2024 08:46
@uiryuu
Copy link
Member Author

uiryuu commented Oct 7, 2024

One request: could there be a "Stop" or "Cancel" button once it starts to load? In case it gets stuck on a bad connection, that would give an impatient user a way out. Would be ideal if it could just show the form again without clearing any of the fields which were filled out.

Will add this in a follow up PR.

svobs pushed a commit to svobs/iina-advance that referenced this pull request Oct 14, 2024
* Show loading window when the resource is network

* Close the window when mainWindow is open

- close the current window when loading a network resource

* Add "Loading Media……" into en.lproj

* Handle error in the OpenURLWindow when network resource is failed to
load

* Optimize layout

* Refactor error handling to make sure always close current window

- Enabled auto save for the open URL window

* Save the loading URL when loading file
@uiryuu
Copy link
Member Author

uiryuu commented Oct 19, 2024

@svobs d14f573 added a button to stop loading.

MouJieQin pushed a commit to MouJieQin/iina-for-varchive that referenced this pull request Oct 21, 2024
* Show loading window when the resource is network

* Close the window when mainWindow is open

- close the current window when loading a network resource

* Add "Loading Media……" into en.lproj

* Handle error in the OpenURLWindow when network resource is failed to
load

* Optimize layout

* Refactor error handling to make sure always close current window

- Enabled auto save for the open URL window

* Save the loading URL when loading file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants