Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Control Notification does not look good on all Android devices #373

Open
2 of 4 tasks
andreasrau-earlynode opened this issue Feb 8, 2021 · 1 comment
Open
2 of 4 tasks

Comments

@andreasrau-earlynode
Copy link

andreasrau-earlynode commented Feb 8, 2021

Description

The media controls notification is rendered completely different on different devices. On some devices I get these good looking controls with the artwork as background. But sometimes I get a notification with only three controls that looks not very good:

Shot

Is it somehow possible to avoid this notification style and get a consistent look for all Android devices?

  1. Sample code (provide repo url or sample code)
import { compose } from 'ramda';
import React, { useEffect } from 'react';
import MusicControl, { Command } from 'react-native-music-control';
import { connect } from 'react-redux';

import { configure } from '../../config/configure';
import {
  getCurrentCourse,
  getCurrentLesson,
  getNextLesson,
  getPreviousLesson,
  setCurrentLesson,
} from '../../features/player/player-reducer';

const get = configure();

const mapStateToProps = state => ({
  nextLesson: getNextLesson(state),
  previousLesson: getPreviousLesson(state),
  currentLesson: getCurrentLesson(state),
  currentCourse: getCurrentCourse(state),
});

export default compose(connect(mapStateToProps, { setCurrentLesson }))(
  ({
    onPlay,
    onPause,
    onSeekForward,
    onSeekBackward,
    nextLesson,
    previousLesson,
    currentLesson,
    setCurrentLesson,
    currentCourse,
  }) => {
    useEffect(() => {
      MusicControl.setNowPlaying({
        title: currentLesson.title,
        artwork: get('REMOTE_IMAGE')(currentCourse.artwork),
      });
    }, [currentLesson, currentCourse]);

    MusicControl.enableBackgroundMode(true);
    MusicControl.enableControl('closeNotification', true, { when: 'always' });
    MusicControl.enableControl('play', true);
    MusicControl.enableControl('pause', true);
    MusicControl.enableControl('stop', false);
    MusicControl.enableControl('previousTrack', true);
    MusicControl.enableControl('skipForward', false);
    MusicControl.enableControl('skipBackward', false);
    MusicControl.enableControl('nextTrack', true);

    MusicControl.on(Command.nextTrack, () => {
      setCurrentLesson(nextLesson);
    });

    MusicControl.on(Command.previousTrack, () => {
      setCurrentLesson(previousLesson);
    });

    MusicControl.on(Command.pause, () => {
      MusicControl.updatePlayback({
        state: MusicControl.STATE_PAUSED,
      });
      onPause();
    });

    MusicControl.on(Command.play, () => {
      MusicControl.updatePlayback({
        state: MusicControl.STATE_PLAYING,
      });
      onPlay();
    });

    return <></>;
  }
);
  1. Platform ?

    • iOS
    • Android
  1. Device
  • Simulator
  • Real device
@13627491210
Copy link

Have you solved it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants