bdecentgmbh / moodle-mod_videotime

The Video Time product family is a set of plugins to integrate videos into moodle courses.
http://bdecent.de/videotime
Other
10 stars 5 forks source link

Playback issue on Moodle Mobile App #73

Open User8501 opened 5 months ago

User8501 commented 5 months ago

When my client tries to play back a video on the Moodle Mobile app (latest version), they encounter the following error: [Class "core_external\util" not found].

The URL in the settings in Video Time will not save. All videos are hosted on YouTube.

Client is using the free version of Video Time 1.8 (2024050600) on Moodle 4.0.12 (Build: 20231211)

Moodle-App-Error-Video-Time

FundacionRomero commented 4 months ago

Hello, we are launching an app directly with the Moodle Mobile team, and we also have that same error. We have all the videos on Vimeo, and we have already installed the latest available version 1.8.1 (VideoTime free and PRO) in our Moodle 4.1.10. Try to contact the support channel, but they only have attention until September, that is, in more than 1 month.

abias commented 3 months ago

Hi @stefanscholz ,

I encountered this issue here as well today.

Running version 2024050601 of mod_videotime (the version which is listed as compatible with Moodle 4.1 on https://moodle.org/plugins/mod_videotime/versions), I had to see that playing Vimeo videos in videotime in the Moodle Mobile App is completely broken, I got the same error message as the issue author.

Digging into the details, I saw that you obviously ported a library change by mistake from the release which targets Moodle 4.2 and upwards to the release which targets Moodle up to 4.1

This class core_external\util which is not found in the screenshot simply does not exist before Moodle 4.2, see https://github.com/moodle/moodle/blob/main/lib/upgrade.txt#L400-L404

Here's my hotfix which allowed Vimeo videos to be played again in videotime in the Mobile App:

diff --git a/classes/output/mobile.php b/classes/output/mobile.php
index 2bfe899..5d932c4 100644
--- a/classes/output/mobile.php
+++ b/classes/output/mobile.php
@@ -31,7 +31,6 @@ require_once($CFG->dirroot . '/lib/externallib.php');

 use context_module;
 use moodle_url;
-use core_external\util;

 /**
  * Mobile output class for Video Time.
@@ -68,7 +67,7 @@ class mobile {

         $videotime->name = format_string($videotime->name);
         list($videotime->intro, $videotime->introformat) =
-            util::format_text($videotime->intro, $videotime->introformat, $context->id, 'mod_videotime', 'intro');
+            external_format_text($videotime->intro, $videotime->introformat, $context->id, 'mod_videotime', 'intro');

         $url = new moodle_url('/mod/videotime/player.php', [
             'id' => $cm->id,
@@ -126,6 +125,6 @@ class mobile {
         global $DB;

         $service = $DB->get_record('external_services', ['shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE], '*', MUST_EXIST);
-        return util::generate_token_for_current_user($service)->token;
+        return external_generate_token_for_current_user($service)->token;
     }
 }

I would be grateful if you could fix the official release for Moodle up to 4.1 likewise.

Cheers, Alex

stefanscholz commented 3 months ago

We have already fixed this in https://github.com/bdecentgmbh/moodle-mod_videotime/commits/VID-820/, which is supposed to be released this week. Sorry for that!

(we accidentally applied the fix which was intended only for M42+ also to M41 and below)

@abias