Update: Experimenting with android tv / bubbleupnp to get stream working

live_tv_play
Juraj Nyíri 3 years ago
parent 7635cc351c
commit 8e42b969f5

@ -19407,16 +19407,9 @@ class PlayController {
case 'androidtv':
if (!lodash.isNil(data.epg)) {
const session = `${Math.floor(Date.now() / 1000)}`;
const streamData = await this.plex.tune(data.channelIdentifier, session);
console.log(streamData);
/*
await this.playViaAndroidTV(
entity.value,
streamData.MediaSubscription[0].MediaGrabOperation[0].Metadata.key,
instantPlay,
provider
);
*/
const streamLink = await this.plex.tune(data.channelIdentifier, session);
console.log(streamLink);
await this.playViaAndroidTV(entity.value, streamLink, instantPlay, provider);
}
else {
await this.playViaAndroidTV(entity.value, processData.guid, instantPlay, provider);
@ -19430,7 +19423,7 @@ class PlayController {
const session = `PlexMeetsHomeAssistant-${Math.floor(Date.now() / 1000)}`;
const streamURL = await this.plex.tune(data.channelIdentifier, session);
console.log(`${this.plex.getBasicURL()}${streamURL}`);
// this.playViaCast(entity.value, `${playlistLink}`);
this.playViaCast(entity.value, `${streamURL}`);
}
else if (this.hass.services.plex) {
const libraryName = lodash.isNil(processData.librarySectionTitle)
@ -19593,22 +19586,31 @@ class PlayController {
}
};
this.playViaCast = (entityName, mediaLink) => {
console.log({
mediaLink = this.plex.authorizeURL(`${this.plex.getBasicURL()}${mediaLink}`);
const payload = {
// eslint-disable-next-line @typescript-eslint/camelcase
entity_id: entityName,
// eslint-disable-next-line @typescript-eslint/camelcase
media_content_type: 'video',
media_content_type: 'application/vnd.apple.mpegurl',
// eslint-disable-next-line @typescript-eslint/camelcase
media_content_id: this.plex.authorizeURL(`${this.plex.getBasicURL()}${mediaLink}`)
});
this.hass.callService('media_player', 'play_media', {
media_content_id: mediaLink
};
/*
payload = {
// eslint-disable-next-line @typescript-eslint/camelcase
entity_id: entityName,
// eslint-disable-next-line @typescript-eslint/camelcase
media_content_type: 'video',
media_content_type: 'cast',
// eslint-disable-next-line @typescript-eslint/camelcase
media_content_id: this.plex.authorizeURL(`${this.plex.getBasicURL()}${mediaLink}`)
});
media_content_id: `{
"app_name": "bubbleupnp",
"media_id": "${mediaLink}",
"media_type": "application/x-mpegURL"
}`
};
*/
console.log(payload);
this.hass.callService('media_player', 'play_media', payload);
};
this.playViaCastPlex = (entityName, contentType, mediaLink) => {
return this.hass.callService('media_player', 'play_media', {

@ -127,16 +127,10 @@ class PlayController {
case 'androidtv':
if (!_.isNil(data.epg)) {
const session = `${Math.floor(Date.now() / 1000)}`;
const streamData = await this.plex.tune(data.channelIdentifier, session);
console.log(streamData);
/*
await this.playViaAndroidTV(
entity.value,
streamData.MediaSubscription[0].MediaGrabOperation[0].Metadata.key,
instantPlay,
provider
);
*/
const streamLink = await this.plex.tune(data.channelIdentifier, session);
console.log(streamLink);
await this.playViaAndroidTV(entity.value, streamLink, instantPlay, provider);
} else {
await this.playViaAndroidTV(entity.value, processData.guid, instantPlay, provider);
}
@ -150,7 +144,7 @@ class PlayController {
const session = `PlexMeetsHomeAssistant-${Math.floor(Date.now() / 1000)}`;
const streamURL = await this.plex.tune(data.channelIdentifier, session);
console.log(`${this.plex.getBasicURL()}${streamURL}`);
// this.playViaCast(entity.value, `${playlistLink}`);
this.playViaCast(entity.value, `${streamURL}`);
} else if (this.hass.services.plex) {
const libraryName = _.isNil(processData.librarySectionTitle)
? this.libraryName
@ -325,22 +319,33 @@ class PlayController {
};
private playViaCast = (entityName: string, mediaLink: string): void => {
console.log({
mediaLink = this.plex.authorizeURL(`${this.plex.getBasicURL()}${mediaLink}`);
const payload: any = {
// eslint-disable-next-line @typescript-eslint/camelcase
entity_id: entityName,
// eslint-disable-next-line @typescript-eslint/camelcase
media_content_type: 'video',
media_content_type: 'application/vnd.apple.mpegurl',
// eslint-disable-next-line @typescript-eslint/camelcase
media_content_id: this.plex.authorizeURL(`${this.plex.getBasicURL()}${mediaLink}`)
});
this.hass.callService('media_player', 'play_media', {
media_content_id: mediaLink
};
/*
payload = {
// eslint-disable-next-line @typescript-eslint/camelcase
entity_id: entityName,
// eslint-disable-next-line @typescript-eslint/camelcase
media_content_type: 'video',
media_content_type: 'cast',
// eslint-disable-next-line @typescript-eslint/camelcase
media_content_id: this.plex.authorizeURL(`${this.plex.getBasicURL()}${mediaLink}`)
});
media_content_id: `{
"app_name": "bubbleupnp",
"media_id": "${mediaLink}",
"media_type": "application/x-mpegURL"
}`
};
*/
console.log(payload);
this.hass.callService('media_player', 'play_media', payload);
};
private playViaCastPlex = (entityName: string, contentType: string, mediaLink: string): Promise<void> => {

Loading…
Cancel
Save