Looks like an addon (mod/block/filter/player) conflict of some sort. In the 3.1 what addons are installed related to Youtube and media playing?
Also the API set up in the 3.1 ... credentials/secret/key/users related.
Check compatibility: https://moodle.org/plugins/
'SoS', Ken