Fix subscribing in channel view and properly show live video

This commit is contained in:
PrestonN 2018-07-30 20:33:14 -04:00
parent 1bf7af4c28
commit ec310e425a
3 changed files with 7 additions and 4 deletions

View File

@ -32,6 +32,8 @@ function playVideo(videoId) {
hideViews();
playerView.videoId = videoId;
playerView.video480p = undefined;
playerView.video720p = undefined;
playerView.embededHtml = "<iframe width='560' height='315' src='https://www.youtube-nocookie.com/embed/" + videoId + "?rel=0' frameborder='0' allow='autoplay; encrypted-media' allowfullscreen></iframe>";
const checkSavedVideo = videoIsSaved(videoId);

View File

@ -11,8 +11,10 @@
function youtubeAPI(resource, params, success) {
params.key = settingsView.apiKey;
let requestUrl = 'https://www.googleapis.com/youtube/v3/' + resource + '?' + $.param(params);
if (useTor) {
tor.request('https://www.googleapis.com/youtube/v3/' + resource + '?' + $.param(params), function(err, res, body) {
tor.request(requestUrl, (err, res, body) => {
if (!err && res.statusCode == 200) {
success(JSON.parse(body));
} else {
@ -25,8 +27,7 @@ function youtubeAPI(resource, params, success) {
});
} else {
$.getJSON(
'https://www.googleapis.com/youtube/v3/' + resource,
params,
requestUrl,
success
).fail((xhr, textStatus, error) => {
showToast('There was an error calling the YouTube API.');

View File

@ -6,7 +6,7 @@
<span class='channelViewName'>{{name}}</span>
<br />
<span class='channelViewSubs'>{{subCount}} Subscribers</span>
<div id='subscribeButton' class='channelSubButton' v-on:click='subscription(channelId);'>
<div id='subscribeButton' class='channelSubButton' v-on:click='subscription(id);'>
{{subButtonText}}
</div>
</div>