mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-15 21:36:36 +00:00
Inline media player entity (#1191)
This commit is contained in:
parent
41990767e2
commit
4a734fbffc
@ -5,7 +5,7 @@ import '@polymer/paper-styles/element-styles/paper-material-styles.js';
|
||||
import { html } from '@polymer/polymer/lib/utils/html-tag.js';
|
||||
import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
||||
|
||||
import '../util/hass-media-player-model.js';
|
||||
import HassMediaPlayerEntity from '../util/hass-media-player-model.js';
|
||||
|
||||
import computeStateName from '../common/entity/compute_state_name.js';
|
||||
import EventsMixin from '../mixins/events-mixin.js';
|
||||
@ -261,7 +261,7 @@ class HaMediaPlayerCard extends LocalizeMixin(EventsMixin(PolymerElement)) {
|
||||
}
|
||||
|
||||
computePlayerObj(hass, stateObj) {
|
||||
return new window.HassMediaPlayerEntity(hass, stateObj);
|
||||
return new HassMediaPlayerEntity(hass, stateObj);
|
||||
}
|
||||
|
||||
computePrimaryText(localize, playerObj) {
|
||||
|
@ -8,7 +8,7 @@ import { html } from '@polymer/polymer/lib/utils/html-tag.js';
|
||||
import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
||||
|
||||
import '../../../components/ha-paper-slider.js';
|
||||
import '../../../util/hass-media-player-model.js';
|
||||
import HassMediaPlayerEntity from '../../../util/hass-media-player-model.js';
|
||||
|
||||
|
||||
import attributeClassNames from '../../../common/entity/attribute_class_names';
|
||||
@ -136,7 +136,7 @@ import EventsMixin from '../../../mixins/events-mixin.js';
|
||||
}
|
||||
|
||||
computePlayerObj(hass, stateObj) {
|
||||
return new window.HassMediaPlayerEntity(hass, stateObj);
|
||||
return new HassMediaPlayerEntity(hass, stateObj);
|
||||
}
|
||||
|
||||
playerObjChanged(newVal, oldVal) {
|
||||
|
@ -4,6 +4,7 @@ import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
||||
|
||||
import '../components/entity/state-info.js';
|
||||
import LocalizeMixin from '../mixins/localize-mixin.js';
|
||||
import HassMediaPlayerEntity from '../util/hass-media-player-model.js';
|
||||
|
||||
/*
|
||||
* @appliesMixin LocalizeMixin
|
||||
@ -66,7 +67,7 @@ class StateCardMediaPlayer extends LocalizeMixin(PolymerElement) {
|
||||
}
|
||||
|
||||
computePlayerObj(hass, stateObj) {
|
||||
return new window.HassMediaPlayerEntity(hass, stateObj);
|
||||
return new HassMediaPlayerEntity(hass, stateObj);
|
||||
}
|
||||
|
||||
computePrimaryText(localize, playerObj) {
|
||||
|
@ -1,11 +1,11 @@
|
||||
window.HassMediaPlayerEntity = function (hass, stateObj) {
|
||||
export default function HassMediaPlayerEntity(hass, stateObj) {
|
||||
this.hass = hass;
|
||||
this.stateObj = stateObj;
|
||||
};
|
||||
}
|
||||
|
||||
function addGetter(name, getter) {
|
||||
Object.defineProperty(
|
||||
window.HassMediaPlayerEntity.prototype, name,
|
||||
HassMediaPlayerEntity.prototype, name,
|
||||
{ get: getter }
|
||||
);
|
||||
}
|
||||
@ -144,7 +144,7 @@ addGetter('sourceList', function () {
|
||||
return this.stateObj.attributes.source_list;
|
||||
});
|
||||
|
||||
Object.assign(window.HassMediaPlayerEntity.prototype, {
|
||||
Object.assign(HassMediaPlayerEntity.prototype, {
|
||||
mediaPlayPause: function () {
|
||||
this.callService('media_play_pause');
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user