scratchfoundation / scratch-gui

Graphical User Interface for creating and running Scratch 3.0 projects.
https://scratchfoundation.github.io/scratch-gui/develop/
BSD 3-Clause "New" or "Revised" License
4.46k stars 3.55k forks source link

Web / Desktop - Loading a game from local computer not working #5639

Open SmileSoftSr opened 4 years ago

SmileSoftSr commented 4 years ago
  1. Start either web (Google Chrome or Firefox) or desktop version of Scratch 3
  2. Click on File
  3. Choose 'Load from your computer'
  4. Select *.sb3 to load
  5. ... Nothing happens.

Operating System and Browser

Windows 7 64bit, SP 1 Google Chrome (latest version), Firefox (latest version), both in normal operating (non-incognito) mode. Cookies are enabled.

Console warnings and errors on loading (both browsers):

Warning - The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. (2148 occurrences - ends when the floating tutorial modal is closed, or tutorial started)
Error - Access to XMLHttpRequest at 'https://api.scratch.mit.edu/projects/undefined' from origin 'https://scratch.mit.edu' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Error - projects.bundle.js:31 www  Error: Internal XMLHttpRequest Error
    at i (common.bundle.js:16)
    at XMLHttpRequest.t (common.bundle.js:16)
    at XMLHttpRequest.n (projects.bundle.js:31) (2 sequential occurrences)
Error - projects.bundle.js:31 PUT https://api.scratch.mit.edu/projects/undefined net::ERR_FAILED (2 occurrences)

If the tutorial modal is closed (without playing the video), and loading of local game attempted, the console throws this error:

common.bundle.js:22 Uncaught TypeError: Cannot read property 'type' of undefined
    at projects.bundle.js:125
    at common.bundle.js:38
    at Object.requestProjectUpload (projects.bundle.js:166)
    at t.value (projects.bundle.js:166)
    at n (projects.bundle.js:52)
    at Object.u (common.bundle.js:22)
    at Object.invokeGuardedCallback (common.bundle.js:30)
    at Object.invokeGuardedCallbackAndCatchFirstError (common.bundle.js:30)
    at m (common.bundle.js:22)
    at y (common.bundle.js:22)
    at b (common.bundle.js:22)
    at Array.forEach (<anonymous>)
    at g (common.bundle.js:22)
    at $ (common.bundle.js:22)
    at Gn (common.bundle.js:30)
    at Ce (common.bundle.js:22)
    at batchedUpdates (common.bundle.js:22)
    at Q (common.bundle.js:22)
    at Le (common.bundle.js:22)

Cache cleared multiple times. Computer restarted multiple times. Same outcome.

Related: https://github.com/LLK/scratch-gui/issues/4332 (the last reply was almost 5 months ago).

apple502j commented 4 years ago

Can you attach your sb3 here?

SmileSoftSr commented 4 years ago

Of course. It's about 11 MB, so I hope that won't be an issue. Scratch Project.zip

apple502j commented 4 years ago

I can load it - Windows 10 Firefox 75 (make sure you extract the sb3 from the zip first of course)

SmileSoftSr commented 4 years ago

Here's what happening in my case.

Chrome, Firefox (clean cache as of this morning):

  1. Accessed https://sratch.mit.edu/projects/editor (notice the lack of the GET parameter)
  2. Loaded the game successfully in both browsers (not tested simultaneously, but with a delay of a couple of minutes - first Chrome, then Firefox)
  3. Close both browsers
  4. Reopen both browsers, and try again (cache leftover from the last run)
  5. Not working.

Tried the same with steps 1-2 with the GET parameter present (tutorial=getStarted), and cache cleared - couldn't load the game.

As far as the desktop version is concerned, I think the issue lies in resizing / maximizing the window, while Scratch is loading. If I don't maximize the window, or let it lose focus, I can load the game (maximizing the window after Scratch finishes loading causes no problems, and consecutive loads - leaving Scratch and starting it again - also work).

However, if I maximize the window while Scratch is loading (blue screen with initializing blocks message), I can not load the game / project. So waiting for it to load seems to be a workaround. Not sure if this is an issue on other platforms and OS, but it is on Windows 7.