Merge branch 'master' into default_volume

This commit is contained in:
Sam 2020-05-23 13:49:16 +10:00 committed by GitHub
commit c816016e46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 6 deletions

View File

@ -15,6 +15,7 @@ const SettingsHelper = require('./SettingsHelper');
const settings = new SettingsHelper();
const root = express();
root.options('*', cors()) // enable pre-flight across-the-board
root.use(cors({ credentials: false }));
root.use((req, res, next) => {
res.setHeader('Access-Control-Allow-Credentials', false);
@ -53,7 +54,18 @@ root.use(serverRoot, ptserver);
root.get('*', (req, res) => res.send('You\'ve connected to the SLServer, you\'re probably looking for the webapp.'));
const rootserver = require('http').createServer(root);
const ptserver_io = require('socket.io')(rootserver, { path: `${serverRoot}/socket.io` });
const ptserver_io = require('socket.io')(rootserver, {
path: `${serverRoot}/socket.io`,
handlePreflightRequest: (req, res) => {
var headers = {
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
'Access-Control-Allow-Origin': req.headers.origin || '*',
'Access-Control-Allow-Credentials': true
};
res.writeHead(200, headers);
res.end();
}
});
ptserver_io.on('connection', (socket) => {
console.log('Someone connected to the SyncLounge server socket');

View File

@ -638,6 +638,11 @@ export default {
return;
}
if (!changeItem) {
// Update offset to current time to resume where we were
this.offset = this.playertime;
}
const req = () => {
this.sources = this.generateSources();
request(this.getSourceByLabel(this.chosenQuality).initUrl, (error, response, body) => {
@ -766,6 +771,7 @@ export default {
session: this.sessionId,
offset: 0,
// offset: Math.round(this.playertime / 1000),
time: Math.round(this.playertime / 1000),
subtitles: 'burn',
copyts: 1,
'Accept-Language': 'en',

View File

@ -316,9 +316,6 @@ export default {
},
onPlayerLoadeddata(player) {
const that = this;
this.$nextTick(() => {
this.player.currentTime(this.initialOffset / 1000);
});
player.on(['pause'], () => {
this.isPlaying = 'paused';
@ -423,8 +420,9 @@ export default {
});
},
playerReadied(player) {
// console.log('Setting volume to ' + this.$store.getters.getSettingPTPLAYERVOLUME )
// console.log('Setting volume to ' + this.$store.getters.getSettingPTPLAYERVOLUME)
this.player.volume(this.$store.getters.getSettings.PTPLAYERVOLUME || 100);
this.player.currentTime(this.initialOffset / 1000);
},
},

View File

@ -306,7 +306,7 @@ export default {
// Check if we need to autoplay
if (
(ourTimeline.state === 'stopped' || !ourTimeline.state) &&
hostTimeline.playerState !== 'stopped'
hostTimeline.playerState !== 'stopped' || rootState.rawTitle !== hostTimeline.rawTitle
) {
if (rootState.blockAutoPlay || !hostTimeline.rawTitle) {
return resolve();
@ -327,6 +327,7 @@ export default {
});
}
rootState.rawTitle = hostTimeline.rawTitle;
sendNotification(`Searching Plex Servers for "${hostTimeline.rawTitle}"`);
const result = await rootState.chosenClient
.playContentAutomatically(