Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit 9cf3d62

Browse files
committed
Slowly removing internal video player
1 parent 310ce78 commit 9cf3d62

File tree

2 files changed

+52
-59
lines changed

2 files changed

+52
-59
lines changed

src/electron/app/js/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,10 @@ function showFollowing(u) { ipcRenderer.send('open-followings-window', { userid:
427427

428428
function showFollowers(u) { ipcRenderer.send('open-followers-window', { userid: u === undefined ? currentUser.uid : u }) }
429429

430-
function playVideo(vid) {
430+
function playVideo(src, vid) {
431+
DataManager.addWatched(vid)
431432
$('.replay-'+vid+' svg.watched').addClass('bright').addClass('green')
432-
ipcRenderer.send('watch-replay', { videoid: vid })
433+
ipcRenderer.send('watch-replay', { source: src })
433434
}
434435

435436
function sortReplays(name) {
@@ -1259,7 +1260,7 @@ function _performHashtagSearch() {
12591260
`<a id="download-replay-${results[i].vid}" class="button icon-only" onClick="downloadVideo('${results[i].vid}')" title="Download Replay"><svg class="dim" viewBox="0 0 20 20"><path d="M17.064,4.656l-2.05-2.035C14.936,2.544,14.831,2.5,14.721,2.5H3.854c-0.229,0-0.417,0.188-0.417,0.417v14.167c0,0.229,0.188,0.417,0.417,0.417h12.917c0.229,0,0.416-0.188,0.416-0.417V4.952C17.188,4.84,17.144,4.733,17.064,4.656M6.354,3.333h7.917V10H6.354V3.333z M16.354,16.667H4.271V3.333h1.25v7.083c0,0.229,0.188,0.417,0.417,0.417h8.75c0.229,0,0.416-0.188,0.416-0.417V3.886l1.25,1.239V16.667z M13.402,4.688v3.958c0,0.229-0.186,0.417-0.417,0.417c-0.229,0-0.417-0.188-0.417-0.417V4.688c0-0.229,0.188-0.417,0.417-0.417C13.217,4.271,13.402,4.458,13.402,4.688"></path></svg></a>`
12601261

12611262
$('#list tbody').append(`
1262-
<tr data-id="${results[i].vid}" onClick="playVideo('${results[i].vid}')" class="user-${results[i].userid}">
1263+
<tr data-id="${results[i].vid}" onClick="playVideo('${results[i].source}', '${results[i].vid}')" class="user-${results[i].userid}">
12631264
<td width="410">${results[i].title}</td>
12641265
<td width="120" align="center">${ds}</td>
12651266
<td width="50" align="right">${length}</td>

src/electron/index.js

Lines changed: 48 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -665,64 +665,56 @@ const dlQueue = async.queue((task, done) => {
665665
* Watch a Replay - Use either internal player or external depending on settings
666666
*/
667667
ipcMain.on('watch-replay', (event, arg) => {
668-
DataManager.addWatched(arg.videoid)
668+
let playerpath = appSettings.get('general.playerpath') || ' '
669669

670-
LiveMe.getVideoInfo(arg.videoid)
671-
.then(video => {
672-
let playerpath = appSettings.get('general.playerpath') || ' '
673-
674-
if (playerpath.length > 5) {
675-
exec(playerpath.replace('%url%', LiveMe.pickProperVideoSource(video)))
676-
} else {
677-
// Open internal player
678-
if (playerWindow == null) {
679-
let winposition = appSettings.get('position.playerWindow') ? appSettings.get('position.playerWindow') : [-1, -1]
680-
let winsize = appSettings.get('size.playerWindow') ? appSettings.get('size.playerWindow') : [360, 640]
681-
682-
playerWindow = new BrowserWindow({
683-
icon: path.join(__dirname, 'appicon.png'),
684-
width: winsize[0],
685-
height: winsize[1],
686-
x: winposition[0] !== -1 ? winposition[0] : null,
687-
y: winposition[1] !== -1 ? winposition[1] : null,
688-
minWidth: 360,
689-
minHeight: 360,
690-
darkTheme: true,
691-
autoHideMenuBar: false,
692-
disableAutoHideCursor: true,
693-
titleBarStyle: 'default',
694-
maximizable: false,
695-
frame: false,
696-
backgroundColor: '#000000',
697-
webPreferences: {
698-
webSecurity: false,
699-
textAreasAreResizable: false,
700-
plugins: true
701-
}
702-
})
703-
playerWindow.setMenu(Menu.buildFromTemplate(getMiniMenuTemplate()))
704-
playerWindow.on('close', () => {
705-
appSettings.set('position.playerWindow', playerWindow.getPosition())
706-
appSettings.set('size.playerWindow', playerWindow.getSize())
707-
708-
playerWindow.webContents.session.clearCache(() => {
709-
// Purge the cache to help avoid eating up space on the drive
710-
})
711-
playerWindow = null
712-
})
713-
playerWindow.loadURL(`file://${__dirname}/app/player.html`)
714-
playerWindow.webContents.once('dom-ready', () => {
715-
playerWindow.webContents.send('play-video', video, appSettings.get('player'))
716-
})
717-
} else {
718-
playerWindow.webContents.send('play-video', video, appSettings.get('player'))
670+
if (playerpath.length > 5) {
671+
exec(playerpath.replace('%url%', arg.source))
672+
} else {
673+
// Open internal player
674+
if (playerWindow == null) {
675+
let winposition = appSettings.get('position.playerWindow') ? appSettings.get('position.playerWindow') : [-1, -1]
676+
let winsize = appSettings.get('size.playerWindow') ? appSettings.get('size.playerWindow') : [360, 640]
677+
678+
playerWindow = new BrowserWindow({
679+
icon: path.join(__dirname, 'appicon.png'),
680+
width: winsize[0],
681+
height: winsize[1],
682+
x: winposition[0] !== -1 ? winposition[0] : null,
683+
y: winposition[1] !== -1 ? winposition[1] : null,
684+
minWidth: 360,
685+
minHeight: 360,
686+
darkTheme: true,
687+
autoHideMenuBar: false,
688+
disableAutoHideCursor: true,
689+
titleBarStyle: 'default',
690+
maximizable: false,
691+
frame: false,
692+
backgroundColor: '#000000',
693+
webPreferences: {
694+
webSecurity: false,
695+
textAreasAreResizable: false,
696+
plugins: true
719697
}
720-
playerWindow.focus()
721-
}
722-
})
723-
.catch(err => {
724-
console.log('[watch-replay] getVideoInfo Error:', err)
725-
})
698+
})
699+
playerWindow.setMenu(Menu.buildFromTemplate(getMiniMenuTemplate()))
700+
playerWindow.on('close', () => {
701+
appSettings.set('position.playerWindow', playerWindow.getPosition())
702+
appSettings.set('size.playerWindow', playerWindow.getSize())
703+
704+
playerWindow.webContents.session.clearCache(() => {
705+
// Purge the cache to help avoid eating up space on the drive
706+
})
707+
playerWindow = null
708+
})
709+
playerWindow.loadURL(`file://${__dirname}/app/player.html`)
710+
playerWindow.webContents.once('dom-ready', () => {
711+
playerWindow.webContents.send('play-video', arg.source, appSettings.get('player'))
712+
})
713+
} else {
714+
playerWindow.webContents.send('play-video', arg.source, appSettings.get('player'))
715+
}
716+
playerWindow.focus()
717+
}
726718
})
727719

728720
ipcMain.on('save-player-options', (event, options) => {

0 commit comments

Comments
 (0)