diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index 97871d4..ad3654c 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -18700,8 +18700,11 @@ class PlayController { constructor(hass, plex, entity) { this.play = async (mediaID, instantPlay = false) => { const serverID = await this.plex.getServerID(); - const command = `am start -a android.intent.action.VIEW 'plex://server://${serverID}/com.plexapp.plugins.library/library/metadata/${mediaID}'`; - console.log(command); + let command = `am start`; + if (instantPlay) { + command += ' --ez "android.intent.extra.START_PLAYBACK" true'; + } + command += ` -a android.intent.action.VIEW 'plex://server://${serverID}/com.plexapp.plugins.library/library/metadata/${mediaID}'`; this.hass.callService('androidtv', 'adb_command', { // eslint-disable-next-line @typescript-eslint/camelcase entity_id: this.entity, @@ -18712,17 +18715,6 @@ class PlayController { entity_id: this.entity, command }); - if (instantPlay) { - console.log('instantPlay'); - setTimeout(() => { - console.log('PLAY'); - this.hass.callService('androidtv', 'adb_command', { - // eslint-disable-next-line @typescript-eslint/camelcase - entity_id: this.entity, - command: 'CENTER' - }); - }, 5000); - } }; this.isPlaySupported = () => { return (this.hass.states[this.entity] && diff --git a/src/modules/PlayController.ts b/src/modules/PlayController.ts index 4b5eaf6..48100ce 100644 --- a/src/modules/PlayController.ts +++ b/src/modules/PlayController.ts @@ -16,9 +16,14 @@ class PlayController { play = async (mediaID: number, instantPlay = false): Promise => { const serverID = await this.plex.getServerID(); - const command = `am start -a android.intent.action.VIEW 'plex://server://${serverID}/com.plexapp.plugins.library/library/metadata/${mediaID}'`; + let command = `am start`; + + if (instantPlay) { + command += ' --ez "android.intent.extra.START_PLAYBACK" true'; + } + + command += ` -a android.intent.action.VIEW 'plex://server://${serverID}/com.plexapp.plugins.library/library/metadata/${mediaID}'`; - console.log(command); this.hass.callService('androidtv', 'adb_command', { // eslint-disable-next-line @typescript-eslint/camelcase entity_id: this.entity, @@ -29,17 +34,6 @@ class PlayController { entity_id: this.entity, command }); - if (instantPlay) { - console.log('instantPlay'); - setTimeout(() => { - console.log('PLAY'); - this.hass.callService('androidtv', 'adb_command', { - // eslint-disable-next-line @typescript-eslint/camelcase - entity_id: this.entity, - command: 'CENTER' - }); - }, 5000); - } }; isPlaySupported = (): boolean => {