Giter Site home page Giter Site logo

Feature request - sleep and wake about snow HOT 24 CLOSED

jrfeng avatar jrfeng commented on May 22, 2024
Feature request - sleep and wake

from snow.

Comments (24)

jrfeng avatar jrfeng commented on May 22, 2024

@webwayscript Can you describe it in detail about "sleep" and "wake"

from snow.

webwayscript avatar webwayscript commented on May 22, 2024

sleep time:
assume time is 9.30 pm . if user want stop music 10.30 pm. they will select 60 minutes in timer or set time 10.30. timer must start running inside service. when finished 60 minutes or reach 10.30 music must stop automatically even app is closed.

also we need get balance running time . ( if user want how many minutes balance is there for stop)

wake up time ( optional)

if user set 6 am for particular song. when if is 6 am audio server must start and play. even app is closed.

check more details in radiodroid app they doing it nicely

from snow.

jrfeng avatar jrfeng commented on May 22, 2024

OK, I will add support for "sleep time", but “wake up” need yourself handle it.

from snow.

jrfeng avatar jrfeng commented on May 22, 2024

@webwayscript sleep timer is finished.

from snow.

jrfeng avatar jrfeng commented on May 22, 2024

New methods on PlayerClient:

  • startSleepTimer(long time): start sleep timer (unit: ms). time must >= 0.
  • cancelSleepTimer(): cancel started sleep timer.
  • addOnSleepTimerStateChangeListener(SleepTimer.OnStateChangeListener listener)
  • addOnSleepTimerStateChangeListener(LifecycleOwner owner, SleepTimer.OnStateChangeListener listener)
  • removeOnSleepTimerStateChangeListener(SleepTimer.OnStateChangeListener listener)
  • isSleepTimerStarted(): check whether sleep timer is started.
  • getSleepTimerTime(): get the time of sleep timer (unit: ms).
  • getSleepTimerStartedTime(): get the time of sleep timer started (unit: ms).

New type:

  • SleepTimer
  • SleepTimer.OnStateChangeListener

from snow.

jrfeng avatar jrfeng commented on May 22, 2024

If you want get the elapsed time of sleep timer, just use SystemClock.elapsedRealtime() - startTime.

from snow.

webwayscript avatar webwayscript commented on May 22, 2024

Thank you bro i will check today

from snow.

webwayscript avatar webwayscript commented on May 22, 2024

from snow.

jrfeng avatar jrfeng commented on May 22, 2024

@webwayscript This bug has been fixed.

from snow.

webwayscript avatar webwayscript commented on May 22, 2024

from snow.

jrfeng avatar jrfeng commented on May 22, 2024

You can put them in MusicItem extras.

Example:

public static final String KEY_CATEGORY = "category";
public static final String KEY_AUDIO_TYPE = "audio_type";

...

Bundle song1Extra = new Bundle();
song1Extra.putString(KEY_CATEGORY, "song 1 category");
song1Extra.putString(KEY_AUDIO_TYPE, "song 1 audio type");

MusicItem song1 = new MusicItem.Builder()
                ...
                .setExtra(song1Extra)
                .build();

Bundle song2Extra = new Bundle();
song2Extra.putString(KEY_CATEGORY, "song 2 category");
song2Extra.putString(KEY_AUDIO_TYPE, "song 2 audio type");

MusicItem song2 = new MusicItem.Builder()
                ...
                .setExtra(song2Extra)
                .build();

Note: Don't put large objects in extra as this may cause Binder to crash.

from snow.

webwayscript avatar webwayscript commented on May 22, 2024

from snow.

webwayscript avatar webwayscript commented on May 22, 2024

from snow.

jrfeng avatar jrfeng commented on May 22, 2024

@webwayscript I need more information about this.

from snow.

webwayscript avatar webwayscript commented on May 22, 2024

from snow.

jrfeng avatar jrfeng commented on May 22, 2024

@webwayscript Sorry, I can't find any useful information from these message.

from snow.

webwayscript avatar webwayscript commented on May 22, 2024

from snow.

jrfeng avatar jrfeng commented on May 22, 2024

OK, I will add support for it.

from snow.

jrfeng avatar jrfeng commented on May 22, 2024

@webwayscript I optimized some code that might cause bugs, you can try it again.

from snow.

webwayscript avatar webwayscript commented on May 22, 2024

from snow.

jrfeng avatar jrfeng commented on May 22, 2024

@webwayscript add a new method: PlayerService.setMaxIDLETime(int minutes). You can invoke this method in PlayerService.onCreate. After paused or stopped, PlayerService will automatic shutdown when timeout.

from snow.

webwayscript avatar webwayscript commented on May 22, 2024

from snow.

webwayscript avatar webwayscript commented on May 22, 2024

Can you explain more? where i need add? inside my MyPlayerService extends PlayerService ?

from snow.

jrfeng avatar jrfeng commented on May 22, 2024

Example:

public class MyPlayerService extends PlayerService {
    ...

    @Override
    public void onCreate() {
        super.onCreate();

        // set max IDLE time
        setMaxIDLETime(10);
        ...
    }
    ...
}

from snow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.