gstream / iOS-Icecast-Client

iOS Icecast client with custom library.
15 stars 2 forks source link

unconnected when try to stream to shoutcast server Xcode 12 (IOS 14) #4

Open amrkamal2025 opened 3 years ago

amrkamal2025 commented 3 years ago

Hi,

First, thank you for this great effort and this project.

I compiled the libstreamaudio library and add it to my project and I try to connect to the shoutcast server to start streaming and I always get an error in sock.c file the log

init_icecast
shout_set_host
shout_set_protocol
shout_set_port
shout_set_password
shout_set_mount
snhout_set_user
snhout_set_format
shout_Set_format_mp3
shout_open
shout_state_unconnected
hostname = radio, port = 1944, timeout = 0  nsock= 5
sock_try_connection_init n0.000000 444444
(lldb) 

and in the sock.c file line 689

Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)

and the code I use to connect and stream from mp3 file is here

- (IBAction)ButtonConnect:(id)sender {

    NSString *IP = self.label_ip.text;
    int port = [self.label_port.text intValue];
    NSString *password = self.label_password.text;

    unsigned char *myadd = "myhost";
    unsigned char *emp = "";
    unsigned char *pass = "pass";
    ShoutOutputStream_Init(myadd, 1944, emp, emp, pass, 1);

}
- (IBAction)StreamButton:(id)sender {
    NSData *data = [NSData dataWithContentsOfFile:@"song.mp3"];
    NSUInteger length = [data length];
    unsigned char *cdata = (int*)malloc(length);
    [data getBytes:(void*)cdata length:length];

    long long total = 0;
    long long size = length;
    while (total < size) {
        unsigned char *buff[4096];
        for (int i = 0; i < 4096; i++) {
            if (total == size)
                break;
            buff[i] = cdata[total++];
        }
        ShoutOutputStream_Send(buff, 4096);
    }
}
@end

please note that I connect normally from the Windows libshout library and it work and streamed the mp3 files so Iam sure of the connection. so what I did wrong or i missed please I need help.

Screenshot from the log.

Here

Thanks in advance.

gstream commented 3 years ago

Hi @amrkamal2025 , Did you disabled ATS in info.plist?

vannt1991 commented 2 years ago

Hi @amrkamal2025 , i have encountered the same issue, Did you solved this problem? i have disabled ATS in info.plist file.

amrkamal2025 commented 2 years ago

Hi Sorry it was a long time ago, no I did not solve it.

vannt1991 commented 2 years ago

@amrkamal2025 hum, thank you. @gstream Please help me, my server working normally on the android broadcast. But it's not working on this project. image

image

image