Giter Site home page Giter Site logo

Comments (10)

jpxiong avatar jpxiong commented on September 3, 2024

Really ? Does it support dynamic camera switching ? Please show me the code !

from pldroidmediastreaming.

gouravd avatar gouravd commented on September 3, 2024

Yes dynamic camera switching, Zoom, adaptive bitrate, custom resolutions, filters among the important ones.

https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/fragment/BroadcastFragment.java

This above is the UI part that requests camera switch (mBroadcaster.requestOtherCamera();)

https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/AVRecorder.java

This is parent class of mBroadcaster. This calls mCamEncoder.requestOtherCamera(); of the camera encoder class.

https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java

This is the camera encoder that does the actual switching. This calls requestCamera(int cameraNum)

public void requestCamera(int camera) {
if (Camera.getNumberOfCameras() == 1) {
Log.w(TAG, "Ignoring requestCamera: only one device camera available.");
return;
}
mDesiredCamera = camera;
if (mCamera != null && mDesiredCamera != mCurrentCamera) {
// Hot swap camera
mHandler.sendMessage(mHandler.obtainMessage(MSG_RELEASE_CAMERA));
mHandler.sendMessage(mHandler.obtainMessage(MSG_REOPEN_CAMERA));
}
}

@OverRide
public void handleMessage(Message inputMessage) {
int what = inputMessage.what;
Object obj = inputMessage.obj;

        CameraEncoder encoder = mWeakEncoder.get();
        if (encoder == null) {
            Log.w(TAG, "EncoderHandler.handleMessage: encoder is null");
            return;
        }

        try {
            switch (what) {
                case MSG_SET_SURFACE_TEXTURE:
                    encoder.handleSetSurfaceTexture((Integer) obj);
                    break;
                case MSG_FRAME_AVAILABLE:
                    encoder.handleFrameAvailable((SurfaceTexture) obj);
                    break;
                case MSG_REOPEN_CAMERA:
                    encoder.openAndAttachCameraToSurfaceTexture();
                    break;
                case MSG_RELEASE_CAMERA:
                    encoder.releaseCamera();
                    break;
                case MSG_RELEASE:
                    encoder.handleRelease();
                    break;
                case MSG_RESET:
                    encoder.handleReset((SessionConfig) obj);
                    break;
                default:
                    throw new RuntimeException("Unexpected msg what=" + what);
            }
        } catch (IOException e) {
            Log.e(TAG, "Unable to reset! Could be trouble creating MediaCodec encoder");
            e.printStackTrace();
        }
    }

I have used this myself and I can say that the streaming does not stop and restart. Hope this helps

from pldroidmediastreaming.

jpxiong avatar jpxiong commented on September 3, 2024

Yes, it helpful. I had been missed something. But MediaCodec doesn't support update bitrate dynamically API 18. Also i want to change the quality not only the bitrate. Thanks for your helpful information.

from pldroidmediastreaming.

gouravd avatar gouravd commented on September 3, 2024

Yes MediaCodec does not allow to update bitrate, I guess that is why they
rely on Ffmpeg to update the bitrate dynamically. I haven't looked deeper
but I believe that is how they do it.

I also believe Periscope dynamically updates bitrate only. Changing quality
is recommended for big change in internet connection speed. But for
temporary changes in internet speed, changing bitrate only is very helpful.

Also without the dependency on Ffmpeg we cannot predict the final
resolution and quality across different phones. But Ffmpeg allows to set a
constant output (eg 640x360 etc.)/across all platforms. We can then also
set custom aspect ratio(like square)

So I would really request and recommend to reintroduce dependency on Ffmpeg
and all

  1. custom resolutions
    2)Dynamic updating of bitrate
    3)Custom aspect ratio (1:1)
    On Sep 15, 2015 9:09 PM, "jpxiong" [email protected] wrote:

Yes, it helpful. I had been missed something. But MediaCodec doesn't
support update bitrate dynamically API 18. Also i want to change the
quality not only the bitrate. Thanks for your helpful information.


Reply to this email directly or view it on GitHub
#36 (comment)
.

from pldroidmediastreaming.

gouravd avatar gouravd commented on September 3, 2024

Also it would be very helpful if you can guide me how you integrate ActionScript in Android for using NetStream.

from pldroidmediastreaming.

jpxiong avatar jpxiong commented on September 3, 2024

Yes MediaCodec does not allow to update bitrate, I guess that is why they
rely on Ffmpeg to update the bitrate dynamically. I haven't looked deeper
but I believe that is how they do it.

NO! MediaCodec is for encoding and ffmpeg is for packeting and sending frames. If MediaCodec can't update bitrate dynamically, the whole process can't.

reintroduce dependency on Ffmpeg

We wouldn't reintroduce any more.

  1. custom resolutions
    2)Dynamic updating of bitrate
    3)Custom aspect ratio (1:1)

The reqs are on my work task list.

Also it would be very helpful if you can guide me how you integrate ActionScript in Android for using NetStream.

I have no experience about that.

BTW, I's sorry to say that the setLocalFileAbsolutePath can't work on v1.3.3 or v1.3.4. I will add the api back on the later version.

from pldroidmediastreaming.

gouravd avatar gouravd commented on September 3, 2024

"BTW, I's sorry to say that the setLocalFileAbsolutePath can't work on v1.3.3 or v1.3.4. I will add the api back on the later version."

Any timeline when it might be re-introduced. It is actually very very important for us.

"The reqs are on my work task list."

So you mean without ffmpeg dependency, we can get Custom resolutions, Dynamic bitrate update and custom aspect ratio? That would be great.

from pldroidmediastreaming.

gouravd avatar gouravd commented on September 3, 2024

"I have no experience about that."
I asked about ActionScript because I thought you use ActionScript's NetStream for checking status of RTMP endpoint. Could you please let me know how you actually check the status and invoke events like Disconnected, NetBlocking etc..?

I am adding support for 4.1+ using JavaCV and need to add simillar capabilities of checking the rtmp atatus.

from pldroidmediastreaming.

gouravd avatar gouravd commented on September 3, 2024

"BTW, I's sorry to say that the setLocalFileAbsolutePath can't work on v1.3.3 or v1.3.4. I will add the api back on the later version."

Any timeline when it might be re-introduced. It is actually very very important for us.

from pldroidmediastreaming.

gouravd avatar gouravd commented on September 3, 2024

setLocalFileAbsolutePath is available in 1.3.7. Haven't tried it, but will it work?

from pldroidmediastreaming.

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.