(This will make sense to people with projectors.)
This is a blueprint for an automation that pauses movie playback when a certain light is turned on. If you switch the light back off within a defined timeout, it resumes playback.
It tries to detect when only music is playing (as opposed to a movie), but I only tested with YouTube Music on a Chromecast so YMMV.
blueprint: name: Pause movie when light on description: Pauses movie playback when a certain light is turned on. domain: automation input: media_player: name: Media player description: This media device will be paused. selector: entity: domain: media_player light: name: Light description: Turning this light on will pause playback. selector: entity: domain: light timeout: name: Resume playback timeout description: If the light is turned back off within this time, playback will resume. default: 5 selector: number: min: 0 max: 999 unit_of_measurement: minutes mode: box mode: single trigger: - platform: state entity_id: !input light from: 'off' to: 'on' condition: - condition: state entity_id: !input media_player state: playing - condition: not conditions: - condition: state entity_id: !input media_player state: music attribute: media_content_type action: - service: media_player.media_pause entity_id: !input media_player - wait_for_trigger: - platform: state entity_id: !input light from: 'on' to: 'off' continue_on_timeout: false timeout: minutes: !input timeout - service: media_player.media_play entity_id: !input media_player