fix(peertube): Pin library version and correct regex

This commit is contained in:
Lucas Fialho Zawacki 2021-09-28 21:31:07 +00:00
parent 207a629c91
commit cf0186766f

View File

@ -4,7 +4,7 @@ import React, { Component } from 'react'
//To work with PeerTube >=v3.3 URL patterns //To work with PeerTube >=v3.3 URL patterns
const MATCH_URL = new RegExp("(https?)://(.*)(/videos/watch/|/w/)(.*)"); const MATCH_URL = new RegExp("(https?)://(.*)(/videos/watch/|/w/)(.*)");
const SDK_URL = 'https://unpkg.com/@peertube/embed-api/build/player.min.js'; const SDK_URL = 'https://unpkg.com/@peertube/embed-api@0.0.4/build/player.min.js';
// Util function to load an external SDK or return the SDK if it is already loaded // Util function to load an external SDK or return the SDK if it is already loaded
// From https://github.com/CookPete/react-player/blob/master/src/utils.js // From https://github.com/CookPete/react-player/blob/master/src/utils.js
@ -72,7 +72,7 @@ export class PeerTubePlayer extends Component {
const { url } = this.props; const { url } = this.props;
const m = MATCH_URL.exec(url); const m = MATCH_URL.exec(url);
return `${m[1]}://${m[2]}/videos/embed/${m[3]}?api=1&controls=${true}`; return `${m[1]}://${m[2]}/videos/embed/${m[4]}?api=1&controls=${true}`;
}; };
load() { load() {