Coder Social home page Coder Social logo

Using of libstreaming about libstreaming HOT 3 OPEN

LGstudio avatar LGstudio commented on August 19, 2024
Using of libstreaming

from libstreaming.

Comments (3)

lyricalpolymath avatar lyricalpolymath commented on August 19, 2024

did you set the Record_audio permission in the AndroidManifest.xml??

from libstreaming.

LGstudio avatar LGstudio commented on August 19, 2024

Yes, I have the permission
actually since then i have managed to make a localSocet and i can read the data from it ... so i have the InputStream from this socekt, i just don't know now how should i connect this with the started RtspServer.

this part of my code looks like this now: (a new thread):

private class SocketThread extends Thread{
LocalSocket receiver;
LocalServerSocket server;
LocalSocket sender;

    @Override
    public void run(){
        System.out.println("--------IO Thread------ ");


            // Sets the port of the RTSP server
        Editor editor = PreferenceManager.getDefaultSharedPreferences(thisActiviry).edit();
        editor.putString(RtspServer.KEY_PORT, String.valueOf(myPort));
        editor.commit();

        // Configures the SessionBuilder
        SessionBuilder.getInstance()
        .setSurfaceView(mSurfaceView)
        .setPreviewOrientation(90)
        .setContext(getApplicationContext())
        .setAudioEncoder(SessionBuilder.AUDIO_AAC)
        .setAudioQuality(new AudioQuality(44100,128000))
        .setVideoEncoder(SessionBuilder.VIDEO_NONE)     
        .build();

        try{
            server = new LocalServerSocket(LOCAL_SOCKET_ADDRESS);
            sender = new LocalSocket();
            sender.connect(new LocalSocketAddress(LOCAL_SOCKET_ADDRESS));

            myAudioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
            myAudioRecorder.setOutputFormat(MediaRecorder.OutputFormat.AAC_ADTS);
            myAudioRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
            myAudioRecorder.setOutputFile(sender.getFileDescriptor());

            myAudioRecorder.prepare();
            myAudioRecorder.start();

            receiver = server.accept();

            // Starts the RTSP server
            thisActiviry.startService(new Intent(thisActiviry,RtspServer.class));

            int ret = 0;
            int j = 0;
            while ((ret = receiver.getInputStream().read()) != -1 /*&& j < 25*/){
                if (j % 1000 == 0)
                    System.out.println( j + ": ret =" + ret);
                j++;
            }

            System.out.println("ret =" + ret);

        }
        catch (IOException e){
            e.printStackTrace();
        }
        catch (IllegalStateException e){
            e.printStackTrace();
        }
}
}

Actually i can see in the CatLog that the client connects but due to no buffer it disconnects after a while. Also i can see that the mediarecorder put data to the LocalSocket beecause the reciever.getinputstream().read has values.

from libstreaming.

LGstudio avatar LGstudio commented on August 19, 2024

I'm still struggling with the same problem that i can't solve. I have the data stream from the Media Recorder but i have no idea how should i give these data to the RTSPserver. :(

from libstreaming.

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.