Opencast-Moodle / moodle-mod_opencast

Opencast Activity that can display series and episodes from Opencast. The authentication is fully handled by Moodle.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JavaScript error in paella player

trueeh opened this issue · comments

We have imported a series from an older course into a new course. When trying to play the videos via mod_opencast the player ist missing the controls at the bottom, the video does not start and a javascript error occurs:

Uncaught (in promise) TypeError: r.sort is not a function
a paella-core.js:2
u paella-core.js:2
t paella-core.js:2
l paella-user-tracking.js:2
_invoke paella-user-tracking.js:2
k paella-user-tracking.js:2
fe paella-core.js:2
a paella-core.js:2

Moodle is 3.11.6, mod_opencast is newest (main).

Hey @trueeh,

we also discovered the problem, it occurs with the new paella player if there is only a presentation, and no presenter video. Is that the case with your videos? It should be fixed by #18, which will be reviewed and merged soon, accompanied with a new release.

Until then, you can checkout branch update/m40 or manually apply these changes: 1d5d635 (this would work without upgrading the plugin), which should fix the problem.

Greetings
Justus

Hi Justus,

in some cases there was an JS error with "this.mainAudio is null". This is fixed by your changes. But the "r.sort" error remains.

The videos are only presentation. The player is missing the bottom controls and the wheel keeps spinning. In the sources of the player I found it could be a missing/empty framelist?
Screenshot 2022-05-11 at 07-19-39 Test RZ

Greetings
Hartmut

Yes, currently working presentation videos have an empty framelist. The r.sort videos have a filled framelist like (PHP var_dump, URLs shortened)

["frameList"]=>
array(30) {
[85]=>
array(5) {
["id"]=>
string(8) "frame_85"
["mimetype"]=>
string(10) "image/jpeg"
["time"]=>
int(85)
["url"]=>
string(158) "https://oc... ...jpg"
["thumb"]=>
string(158) ""https://oc... ...jpg""
}
[38]=>
array(5) {
["id"]=>
string(8) "frame_38"
["mimetype"]=>
string(10) "image/jpeg"
["time"]=>
int(38)
["url"]=>
string(158) ""https://oc... ...jpg""
["thumb"]=>
string(158) ""https://oc... ...jpg""
}
...
if I comment out the whole foreach {} in function get_frame_list() the controls are present and the video is played.

Greetings
Hartmut

Same video uploaded as presenter video has then an empty framelist and is working.

Greetings
Hartmut

Hi Hartmut,

sorry for the late reply, and thank you for your detailed response, it was very helpful.

You're definitely right, this is a separate problem. It seems that the framelist was mistakenly passed as an object instead of an array. This worked fine with Paella Player 6, but causes problem with Paella 7. This is addressed in this little commit: 01d60d1. (I rewrote the commit history on the update/m40 branch to make the version bump the last commit, so if you are on that branch, you might want to reset hard to origin/update/m40.)

Thanks for bringing this problem up!

Greetings
Justus

The pull request is now merged and a new Release was published.

Thanks again!
Justus

I've installed the new version of the plugin but I see still the same error.
Bildschirmfoto vom 2022-05-25 13-19-27

Hi @mwuttke,
do you have a custom config url entered in the mod_opencast settings? In that case you will need to recreate a config for Paella Player 7, since it sadly doesn't work with configs for Paella 6.
If you are using the default one, could you post the errors in the browser console?
In that case, it also would be helpful if you could enter window.episode in the console, right click the result and click 'Copy object', and send it to me. The video/image urls would be in that message, so if the urls are publicly accessible, and you'd rather not post them publicly, you can send it to me privately to justusdieckmann@wwu.de if you want, then I could test it out locally as well. Otherwise, you can of course always censor the urls.

We use the default config url in the mod_opencast settings.
In the browser console of the chrome browser I can see the following error:
Bildschirmfoto vom 2022-05-25 14-28-24

I found a regression of the last fix, which affected videos without any audio. But the error was a different one. Does your Video have an audio track?

Hmm, I don't really know what that means from the error alone. If you could send the mentioned window.episode object, that would be really great! 😃

You are right, this video has no audio. It is just a random video only for test purposes.

How can I get the window.episode in the browser console you mentioned?

Ah, are you using git? You might checkout the fix/paella7 branch. If it then works, it stems from the same problem that I had, then we'll just create a new release with this fix.

Otherwise, in the console, just type in window.episode, press enter, right click the result and click 'Copy object' to copy it to your clipboard :)
image

Hello Justus, yes I am using git. After checked out the fix/paella brach I am getting the following error message:


Notice: Undefined index: sources in /home/moodle/www-root/moodledev/filter/opencast/filter.php on line 137

Warning: array_key_first() expects parameter 1 to be array, null given in /home/moodle/www-root/moodledev/filter/opencast/filter.php on line 138

Notice: Trying to access array offset on value of type null in /home/moodle/www-root/moodledev/filter/opencast/filter.php on line 138

Notice: Trying to access array offset on value of type null in /home/moodle/www-root/moodledev/filter/opencast/filter.php on line 138

Notice: Trying to access array offset on value of type null in /home/moodle/www-root/moodledev/filter/opencast/filter.php on line 138

Notice: Trying to access array offset on value of type null in /home/moodle/www-root/moodledev/filter/opencast/filter.php on line 139

Notice: Trying to access array offset on value of type null in /home/moodle/www-root/moodledev/filter/opencast/filter.php on line 139

When I enter window.episode in the console of the firefox browser I get undefined.

Thanks for the info! Oh, you are using the filter as the method of supplying the video? Could you try viewing it in an Opencast Video Provider activity (mod_opencast) directly? Either, in the Opencast Block Overview, click on "Add opencast video module to course", or manually add an opencast video provider activity to your course and enter your video there (either selecting via the series/video drop downs, or check the 'Directly enter Opencast ID ...' checkbox and do it that way )

If it does play there, it seems to be an issue with the filter, and we'll create a new issue over there. If it doesn't play, please try the window.episode thing again there :)

Hello Justus, I added the opencast video via the module to the course, like you describe. And the video plays as expected. But not the old videos we added via the filter and the repository.

Hello mwuttke,

I had to execute the "Publish" workflow again for some older videos (published with 8.x) to get them running in mod_opencast.

@justus: I tried to use the latest mod_opencast from main branch and the "mainAudio" error occurs again. Is it only fixed in m40?

@trueeh: Thanks for the tip. I will give it a try. ;-)

Hi @trueeh,

No, all changes on update/m40 are included in the latest patch. However, (I was stupid 😄, and) the fix doesn't work for videos without any audio, does that apply to your video? I already fixed it on the branch fix/paella7, but wanted to wait with the next release to see if Michaels problem is a quick fix as well

Sorry for answering only now.

@trueeh: It's amazing. It actually works. But it does not really scale with a lot of videos. But thanks again for the advice.
And @justusdieckmann: Yes this fix seems to fix the problem. ;-)