Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi is there is way to make an android app for Shoutcast client  so i can broadcast audio from the internal or external audio to Icecast and Shoutcast servers? like mediacst app and broadcastmyself app , i would like to use library for Shoutcast client instate of pure code


What I have tried:

private boolean connect(int p, boolean retrying) {
        try {
            this.sock = new Socket();
            this.sock.connect(new InetSocketAddress(this.host, p), 5000);
            this.sock.setSendBufferSize(AccessibilityEventCompat.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED);
            this.out = this.sock.getOutputStream();
            PrintWriter output = new PrintWriter(this.out);
            output.println(this.password);
            output.flush();
            BufferedReader in = new BufferedReader(new InputStreamReader(this.sock.getInputStream()));
            String line = in.readLine();
            if (line == null || !line.contains("OK")) {
                this.sock.close();
                if (this.listener != null && retrying) {
                    this.listener.onError("Authentification error, please check the password");
                }
                return false;
            }
            while (line != null && line.length() > 0) {
                line = in.readLine();
            }
            this.headers.put("icy-genre", "N/A");
            this.headers.put("icy-pub", "1");
            this.headers.put("icy-name", "N/A");
            this.headers.put("icy-url", "N/A");
            for (Map.Entry<String, String> entry : this.headers.entrySet()) {
                output.println(String.valueOf(entry.getKey()) + ": " + entry.getValue());
            }
            output.println("");
            output.flush();
            this.connected = true;
            if (this.listener != null) {
                this.listener.onConnected();
            }
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            try {
                if (this.sock != null) {
                    this.sock.close();
                }
            } catch (IOException e1) {
                e1.printStackTrace();
            }
            if (this.listener != null && retrying) {
                this.listener.onError("Connection error, please check hostname/port");
            }
            return false;
        }
Posted
Updated 31-Oct-22 4:46am
v2
Comments
David Crow 31-Oct-22 10:41am    
What's the problem, exactly?
Ismail ahmed 2022 31-Oct-22 10:45am    
i would like to use library for Shoutcast client instate of pure code
David Crow 10-Nov-22 22:34pm    
Ok, and what exactly is the problem? We're not mind readers.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900