Skip to content

Blocking of the process until the player load is complete #297

@kokarare1212

Description

@kokarare1212

Is your feature request related to a problem? Please describe.
Since it cannot detect when the player is finished loading, it cannot know when to terminate the program.

Describe the solution you'd like
Thread blocking process until the player finishes loading the music stream (like player.waitReady().get())

Additional context
Example

public class Main(){
    public static void main(String[] args) {
        Session session = new Session.Builder()
                            .userPass("UserName", "Password")
                            .create();
        PlayerConfiguration playerConfiguration = new PlayerConfiguration.Builder()
                    .setOutput(AudioOutput.STDOUT)
                    .build();
        Player player = new Player(playerConfiguration, session);
        try{
            player.waitReady().get();
        } catch(InterruptedException e){
            e.printStackTrace();
        } catch(ExecutionException e){
            e.printStackTrace();
        }
        player.load("spotify:track:xxxxxxxxxxxxxxxxxxxxxx", true);
// Something to block it?
        try{
            session.close();
        } catch(IOException e){
            e.printStackTrace();
        }
        System.exit(0);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions