Skip to content

Commit d5a1d80

Browse files
committed
Resolves #38 - Bug that prevented to kill the process on any platform except macOS fixed. Improved title bar for macOS.
1 parent 0956b12 commit d5a1d80

File tree

9 files changed

+98
-55
lines changed

9 files changed

+98
-55
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ msi-packager.js
88
package-lock.json
99
*.js
1010
!renderers/main/injection.js
11-
!renderers/main/offline_banner.js
11+
!renderers/main/offline_banner.js
12+
!renderers/main/titleBar.js

README.es-ES.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
# **YouTube TV**
55
[![Downloads](https://img.shields.io/github/downloads/marcosrg9/YouTubeTV/total.svg?color=FF0000&label=Total%20downloads)](https://github.com/marcosrg9/YouTubeTV/releases/)
6-
[![Downloads](https://img.shields.io/github/downloads/marcosrg9/YouTubeTV/v2.3.4/total.svg?color=blue&label=2.3.4%20Downloads)](https://github.com/marcosrg9/YouTubeTV/releases/tag/v2.3.4)
6+
[![Downloads](https://img.shields.io/github/downloads/marcosrg9/YouTubeTV/v2.4.1/total.svg?color=blue&label=2.4.1%20Downloads)](https://github.com/marcosrg9/YouTubeTV/releases/tag/v2.4.1)
77

8-
Cliente de YouTube TV sencillo para escritorio basado en [electron](https://www.electronjs.org/). Puede conectar un dispositivo compatible, como un teléfono o un equipo con Google Chrome y enviar los vídeos a la aplicación para visualizarlos.
8+
Cliente de YouTube TV sencillo para escritorio basado en [electron](https://www.electronjs.org/). Puede conectar un dispositivo compatible, como un teléfono o un equipo con Google Chrome y enviar los vídeos a la aplicación para visualizarlos, igual que en ChromeCast o televisores inteligentes con YouTube.
99

1010
<img src="./readme/demo_player.png" width="600px">
1111

@@ -33,19 +33,17 @@ Si ya tiene instalado electron de forma global, podrá iniciar la app con ```ele
3333
## 📦 Builds
3434
El proyecto se puede descargar compilado y listo para su uso. Disponible para Linux, macOS y Windows. En arquitecturas x86, x64 y ARM.
3535

36-
**⚠️ Nota: La arquitectura de 32 bits ya no es soportada para Linux, y se planea eliminar el soporte para Windows en el futuro.**
37-
3836
| Platform | Architecture | Link |
3937
|---------------|:----------------:|:------:|
40-
| Windows | x32/x64 | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4.exe) |
41-
| Linux (Deb) | x64 | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4-amd64.deb) |
42-
| Linux (Deb) | ARM64 | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4-arm64.deb) |
43-
| Linux (Deb) | ARMv7l | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4-armv7l.deb) |
44-
| Linux (RPM) | x64 | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4-x86_64.rpm) |
45-
| Linux (RPM) | ARMv7l | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4-armv7l.rpm) |
46-
| Linux (RPM) | ARM64 | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4-aarch64.rpm) |
47-
| macOS | Intel (x64) | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4.dmg) |
48-
| macOs | Apple Chip (ARM) | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4-arm64.dmg) |
38+
| Windows | x32/x64 | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1.exe) |
39+
| Linux (Deb) | x64 | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1-amd64.deb) |
40+
| Linux (Deb) | ARM64 | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1-arm64.deb) |
41+
| Linux (Deb) | ARMv7l | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1-armv7l.deb) |
42+
| Linux (RPM) | x64 | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1-x86_64.rpm) |
43+
| Linux (RPM) | ARMv7l | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1-armv7l.rpm) |
44+
| Linux (RPM) | ARM64 | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1-aarch64.rpm) |
45+
| macOS | Intel (x64) | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1.dmg) |
46+
| macOs | Apple Chip (ARM) | [Descargar](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1-arm64.dmg) |
4947

5048
[Todas las builds](https://github.com/marcosrg9/YouTubeTV/releases/latest)
5149

@@ -58,12 +56,13 @@ El proyecto se puede descargar compilado y listo para su uso. Disponible para Li
5856

5957
No comprobado en Windows y macOS para plataformas ARM, excepto linux ARM para Raspberry (armv7l).
6058

61-
## 🔌 Mensaje fuera de conexión – [Última actualización – 2.3.4]
62-
63-
Cuando YouTube TV carga sin conexión, mostrará un mensaje indicando que no es posible conectarse con los servidores de YouTube.
64-
65-
Cuando el renderizador detecte conectividad, lo volverá a intentar nuevamente.
66-
<img src="./readme/offline_message_es.png" with="300px">
59+
## ⚡️ Últimos cambios [2.4.0/2.4.1]
60+
### **2.4.1**
61+
- Error solucionado por el cual el proceso de YouTube TV no se cerraba completamente en plataformas que no fueran macOS.
62+
- La barra de título es transparente (solo para macOS).
63+
- La barra de título de la ventana de configuración no cargaba el título en español.
64+
### **2.4.0**
65+
- YouTube TV almacena parámetros del estado de la ventana principal de forma persistente, tales como posición, tamaño, pantalla completa y visibilidad del cursor.
6766

6867
## 🔧 Configuración
6968

README.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
# **YouTube TV**
55
[![Downloads](https://img.shields.io/github/downloads/marcosrg9/YouTubeTV/total.svg?color=FF0000&label=Total%20downloads)](https://github.com/marcosrg9/YouTubeTV/releases/)
6-
[![Downloads](https://img.shields.io/github/downloads/marcosrg9/YouTubeTV/v2.3.4/total.svg?color=blue&label=2.3.4%20Downloads)](https://github.com/marcosrg9/YouTubeTV/releases/tag/v2.3.4)
6+
[![Downloads](https://img.shields.io/github/downloads/marcosrg9/YouTubeTV/latest/total.svg?color=blue&label=2.4.1%20Downloads)](https://github.com/marcosrg9/YouTubeTV/releases/tag/v2.4.1)
77

8-
Simple YouTube TV Client for desktop based on [electron](https://www.electronjs.org/). It can connect with a compatible device, like a phone or a computer with Google Chrome and send videos to the application to visualize them.
8+
Simple YouTube TV Client for desktop based on [electron](https://www.electronjs.org/). You can connect a compatible device such as a phone or computer with Google Chrome and send videos to the app for viewing, just like on ChromeCast or smart TVs with YouTube.
99

1010
<img src="./readme/demo_player.png" width="600px">
1111

@@ -28,20 +28,19 @@ It can use ```npm start``` or else ```npx electron .``` .
2828
If you already have electron installed globally, you can start the app with ```electron .```
2929

3030
## 📦 Builds
31-
The project can be downloaded already built and ready to use. Available for Linux, macOS and Windows. On x86, x84 and ARM architectures.\
32-
**⚠️ Note: The 32-bit architecture is no longer supported on Linux, and support for Windows is planned to be removed in the future.**
31+
The project can be downloaded already built and ready to use. Available for Linux, macOS and Windows. On x86, x84 and ARM architectures.
3332

3433
| Platform | Architecture | Link |
3534
|---------------|:----------------:|:------:|
36-
| Windows | x32/x64 | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4.exe) |
37-
| Linux (Deb) | x64 | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4-amd64.deb) |
38-
| Linux (Deb) | ARM64 | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4-arm64.deb) |
39-
| Linux (Deb) | ARMv7l | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4-armv7l.deb) |
40-
| Linux (RPM) | x64 | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4-x86_64.rpm) |
41-
| Linux (RPM) | ARMv7l | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4-armv7l.rpm) |
42-
| Linux (RPM) | ARM64 | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4-aarch64.rpm) |
43-
| macOS | Intel (x64) | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4.dmg) |
44-
| macOs | Apple Chip (ARM) | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.3.4/YouTube.TV-2.3.4-arm64.dmg) |
35+
| Windows | x32/x64 | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1.exe) |
36+
| Linux (Deb) | x64 | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1-amd64.deb) |
37+
| Linux (Deb) | ARM64 | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1-arm64.deb) |
38+
| Linux (Deb) | ARMv7l | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1-armv7l.deb) |
39+
| Linux (RPM) | x64 | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1-x86_64.rpm) |
40+
| Linux (RPM) | ARMv7l | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1-armv7l.rpm) |
41+
| Linux (RPM) | ARM64 | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1-aarch64.rpm) |
42+
| macOS | Intel (x64) | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1.dmg) |
43+
| macOs | Apple Chip (ARM) | [Download](https://github.com/marcosrg9/YouTubeTV/releases/download/v2.4.1/YouTube_TV-2.4.1-arm64.dmg) |
4544

4645
[All builds](https://github.com/marcosrg9/YouTubeTV/releases/latest)
4746

@@ -53,11 +52,13 @@ The project can be downloaded already built and ready to use. Available for Linu
5352

5453
Not tested on Windows and macOS for ARM platforms, except for ARM Linux for Raspberry (armv7l).
5554

56-
## 🔌 Offline message – [Last update – 2.3.4]
57-
When YouTube TV loads offline, it will display a message indicating that it has been unable to connect to YouTube's servers.
58-
59-
When the renderer detects connectivity, it will try again.
60-
<img src="./readme/offline_message_en.png" with="300px">
55+
## ⚡️ Last changes [2.4.0/2.4.1]
56+
### **2.4.1**
57+
- Fixed bug where the YouTube TV process would not close completely on platforms other than macOS.
58+
- The title bar is transparent (macOS only).
59+
- The title bar of the window did not load the Spanish title.
60+
### **2.4.0**
61+
- YouTube TV persistently stores parameters of the main window state, such as position, size, full screen and cursor visibility.
6162

6263
## 🔧 Configuration
6364

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "youtube-tv-electron",
2+
"name": "youtube-tv",
33
"productName": "YouTube TV",
4-
"version": "2.4.0",
5-
"description": "Cliente de YouTube TV sencillo para escritorio basado en electron.",
4+
"version": "2.4.1",
5+
"description": "Simple YouTube TV client for desktop based on electron.",
66
"main": "main.js",
77
"scripts": {
88
"start": "electron main.js",

readme/demo_player.png

951 KB
Loading

renderers/main/injection.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,4 @@ loadConnectionEvents();
185185
// Escucha las peticiones de consultas al localStorage.
186186
listenLocalStorageQueries();
187187

188-
// Indica al proceso principal que el código se ha cargado.
189-
190188
console.log('JavaScript enhancements loaded at', new Date(Date.now()).toISOString());

renderers/main/main.renderer.ts

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ export class Renderer {
4848
/** JavaScript injection code */
4949
private jsic: string = '';
5050

51+
/** JavaScript injection title bar styles */
52+
private titleBar: string = '';
53+
5154
constructor() {
5255

5356
// Set app menu to null.
@@ -61,7 +64,7 @@ export class Renderer {
6164

6265
this.url = '__DFT__';
6366

64-
this.window.webContents.on('dom-ready', this.injectJSCode.bind(this) );
67+
this.window.webContents.on('dom-ready', () => this.injectJSCode.bind(this));
6568

6669
this.setAccelerators();
6770

@@ -77,9 +80,7 @@ export class Renderer {
7780
}
7881
})
7982
})
80-
.on('window-all-closed', () => {
81-
if (platform() === 'darwin') app.quit();
82-
})
83+
.on('window-all-closed', () => { app.quit() })
8384
}
8485

8586
/** Create a new renderer window. */
@@ -88,7 +89,7 @@ export class Renderer {
8889
this.window = new BrowserWindow({
8990
width: 1230,
9091
height: 720,
91-
titleBarStyle: 'default',
92+
titleBarStyle: platform() === 'darwin' ? 'hiddenInset' : 'default',
9293
fullscreen: false,
9394
fullscreenable: true,
9495
title: 'YouTube TV',
@@ -105,16 +106,34 @@ export class Renderer {
105106

106107
}
107108

108-
/** Inject a JavaScript code into the renderer process to patch events and add some features. */
109-
private async injectJSCode() {
109+
/**
110+
* Inject a JavaScript code into the renderer process to patch events and add some features.
111+
* @param script Type of script to be injected.
112+
* */
113+
private async injectJSCode(script: 'all' | 'patchs' | 'titlebar' = 'all') {
110114

111115
try {
112116

113117
if (this.jsic === '') {
114118
this.jsic = await readFile(join(__dirname, 'injection.js'), { encoding: 'utf8' });
115119
}
116-
117-
this.window.webContents.executeJavaScript(this.jsic);
120+
121+
if (platform() === 'darwin' && this.titleBar === '') {
122+
this.titleBar = await readFile(join(__dirname, 'titleBar.js'), { encoding: 'utf8' });
123+
124+
}
125+
126+
if (script === 'all') {
127+
this.window.webContents.executeJavaScript(this.jsic);
128+
platform() === 'darwin' ? this.window.webContents.executeJavaScript(this.titleBar) : false;
129+
130+
} else if (script === 'patchs') {
131+
this.window.webContents.executeJavaScript(this.jsic);
132+
133+
} else if (script === 'titlebar') {
134+
platform() === 'darwin' ? this.window.webContents.executeJavaScript(this.titleBar) : false;
135+
136+
}
118137

119138
} catch (error) {
120139
debugger;
@@ -280,7 +299,7 @@ export class Renderer {
280299
}
281300
})
282301
.catch(err => {
283-
// If the data is not valid or not available, set the default resolution.
302+
// If the data is invalid or not available, set the default resolution.
284303
this.setResEmulator(3840, 2160);
285304
})
286305

@@ -297,10 +316,14 @@ export class Renderer {
297316
if (value === '__DFT__') url = '';
298317

299318
this.window.loadURL(this._url + url, { userAgent: this.userAgent })
319+
.then(() => {
320+
this.injectJSCode();
321+
})
300322
.catch(async() => {
301323

302324
ipcMain.once('restored', () => { this.url = value });
303325

326+
this.injectJSCode('titlebar');
304327
const offline = await readFile(join(__dirname, 'offline_banner.js'), { encoding: 'utf8' });
305328
this.window.webContents.executeJavaScript(offline);
306329

@@ -314,11 +337,15 @@ export class Renderer {
314337
this.window.fullScreen = true;
315338

316339
this.window.webContents.loadURL(this._url + value, { userAgent: this.userAgent })
340+
.then(() => {
341+
this.injectJSCode();
342+
})
317343
// This should never happen...
318344
.catch(async() => {
319345

320-
ipcMain.once('restored', () => { this.url = value });
321-
346+
ipcMain.once('restored', () => { this.urlByDial = value });
347+
348+
this.injectJSCode('titlebar');
322349
const offline = await readFile(join(__dirname, 'offline_banner.js'), { encoding: 'utf8' });
323350
this.window.webContents.executeJavaScript(offline);
324351

renderers/main/titleBar.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const loadDraggableTittleBar = () => {
2+
3+
const titlebar = document.createElement('div');
4+
5+
titlebar.id = 'draggable_titlebar';
6+
7+
titlebar.style.width = '100%';
8+
titlebar.style.height = '35px';
9+
titlebar.style['-webkit-app-region'] = 'drag';
10+
11+
document.body.appendChild(titlebar);
12+
13+
}
14+
15+
loadDraggableTittleBar();

renderers/settings/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ <h4 id="maxRes" style="margin-bottom: 3px;">Resolución máxima</h4>
8080

8181
const opts = document.querySelector('#res').options;
8282

83+
document.title = msg.settings;
84+
8385
for (let i = 0; i < opts.length; i++) {
8486

8587
opts[i].innerText = opts[i].innerText.replace('Hasta', msg.upto)

0 commit comments

Comments
 (0)