polimediaupv/paella

Problems with player in a subdirectory

Opened this issue · 3 comments

Describe the bug

Edit: Please read the first comment, this description is not entirely correct
The player does not work when it's installed in a subdirectory, because a lot of resources seem to be loaded with an absolute path instead of a relative one. We are using the player in our ILIAS-Opencast-plugin and therefore cannot install the player at the base directory.

Various files cannot be loaded; resources, localizations, config and, since version 6.5.0, hls.min.js:

not_found
hls_not_found

The paths should be like this:
http://localhost:8081/Customizing/global/plugins/Repository/RepositoryObject/Opencast/node_modules/paella_player/build/resources/[...]
Because the player is installed at:
/Customizing/global/plugins/Repository/RepositoryObject/Opencast/node_modules/paella_player

Steps to Reproduce

Install the paella player in a subdirectory, like '[web_base_dir]/paella_player_test/' and open it in the web browser.

Workaround (if any)

The problem with the resources directory exists for some time now, but we were able to fix it with a symlink. We just symlinked the resources folder (which is in a plugin subdirectory) to the ILIAS base directory.
Now since version 6.5.0, other folders/files seem to be affected as well, so we would need a lot of symlinks to fix it. So it would be nice to have a fix for this.

Environment Information

  • Browser - all Browsers
  • Paella version 6.5.0

Thanks a lot for your help!

I have to correct myself, the description above is not exactly right. Also, I found an easy "workaround".

So the scenario in which this bug occurs is this:

  • paella player is installed in some subdirectory, e.g. [web-root]/paellaplayer/build/player
  • the index.html which initializes the player (and includes the scripts) is located at a different subdirectory, e.g. [web-root]/ui/index.html
  • the index.html includes the paella script by absolute paths, so e.g. [web-root]/paellaplayer/build/player/javascript/paella_player_es2015.json

Some resources cannot be loaded in this scenario. For example, it's looking for localization files at [web-root]/localization/paella_en.json, which is the wrong directory.

Edit: This workaround only works for version 6.4.5. With paella 6.5.0, relative paths still produce the above mentioned errors.
Workaround: In index.html, if I load the scripts via relative path instead of an absolute one, so e.g. ../paellaplayer/build/player/javascript/paella_player_es2015.json

So, this is not really an issue for me anymore, since it's easy to solve. Of course it's your decision whether you consider this a bug or want to close the issue.

Update: I found out that there's a 'folder' variable in the player's config.json. There I can set the paths to profiles, resources and skins. With that configured, the only error messages remaining are wrong paths for localization files, hls.min.js and bootstrap.min.css:

Selection_446

Could the remaining errors be fixed via configuration, or do you think this is an issue.

Update: I found a workaround. Before loading the player I manually set the variable:
paella.baseUrl = location.href.replace(/[^/]*$/, '') + 'Customizing/global/plugins/Services/Repository/RepositoryObject/OpenCast/node_modules/paellaplayer/build/player/';

The stuff behind the '+' is the relative url where the paella player is installed. The player seems to build the path to hls.min.js, localization and bootstrap based on this url, which (in my case) doesn't represent the actual base url.

This fixes the issue for me. From my point of view, it would be nice to be able to set the baseUrl in the config.json though. But that's just an idea.