Search in sources :

Example 1 with R5AudioController

use of com.red5pro.streaming.media.R5AudioController in project streaming-android by red5pro.

the class SharedObjectTest method subscribe.

private void subscribe() {
    R5Configuration config = new R5Configuration(R5StreamProtocol.RTSP, TestContent.GetPropertyString("host"), TestContent.GetPropertyInt("port"), TestContent.GetPropertyString("context"), TestContent.GetPropertyFloat("subscribe_buffer_time"));
    config.setLicenseKey(TestContent.GetPropertyString("license_key"));
    config.setBundleID(getActivity().getPackageName());
    R5Connection connection = new R5Connection(config);
    // setup a new stream using the connection
    stream = new R5Stream(connection);
    stream.audioController = new R5AudioController();
    stream.audioController.sampleRate = TestContent.GetPropertyInt("sample_rate");
    stream.client = this;
    stream.setListener(this);
    // show all logging
    stream.setLogLevel(R5Stream.LOG_LEVEL_DEBUG);
    // display.setZOrderOnTop(true);
    preview.attachStream(stream);
    preview.showDebugView(TestContent.GetPropertyBool("debug_view"));
    stream.play(TestContent.GetPropertyString("stream1"));
}
Also used : R5Configuration(com.red5pro.streaming.config.R5Configuration) R5Connection(com.red5pro.streaming.R5Connection) R5Stream(com.red5pro.streaming.R5Stream) R5AudioController(com.red5pro.streaming.media.R5AudioController)

Example 2 with R5AudioController

use of com.red5pro.streaming.media.R5AudioController in project streaming-android by red5pro.

the class SubscribeService method startSubscribe.

public void startSubscribe() {
    if (subscribe != null) {
        subscribe.stop();
    }
    R5Configuration config = new R5Configuration(R5StreamProtocol.RTSP, TestContent.GetPropertyString("host"), TestContent.GetPropertyInt("port"), TestContent.GetPropertyString("context"), TestContent.GetPropertyFloat("subscribe_buffer_time"));
    config.setLicenseKey(TestContent.GetPropertyString("license_key"));
    config.setBundleID(getPackageName());
    R5Connection connection = new R5Connection(config);
    // setup a new stream using the connection
    subscribe = new R5Stream(connection);
    // show all logging
    subscribe.setLogLevel(R5Stream.LOG_LEVEL_DEBUG);
    if (display != null) {
        attachDisplay();
    }
    subscribe.audioController = new R5AudioController();
    subscribe.audioController.sampleRate = TestContent.GetPropertyInt("sample_rate");
    subscribe.play(TestContent.GetPropertyString("stream1"));
}
Also used : R5Configuration(com.red5pro.streaming.config.R5Configuration) R5Connection(com.red5pro.streaming.R5Connection) R5Stream(com.red5pro.streaming.R5Stream) R5AudioController(com.red5pro.streaming.media.R5AudioController)

Example 3 with R5AudioController

use of com.red5pro.streaming.media.R5AudioController in project streaming-android by red5pro.

the class SubscribeNoViewTest method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Create the configuration from the tests.xml
    R5Configuration config = new R5Configuration(R5StreamProtocol.RTSP, TestContent.GetPropertyString("host"), TestContent.GetPropertyInt("port"), TestContent.GetPropertyString("context"), TestContent.GetPropertyFloat("subscribe_buffer_time"));
    config.setLicenseKey(TestContent.GetPropertyString("license_key"));
    config.setBundleID(getActivity().getPackageName());
    R5Connection connection = new R5Connection(config);
    // setup a new stream using the connection
    subscribe = new R5Stream(connection);
    subscribe.setListener(this);
    subscribe.audioController = new R5AudioController();
    subscribe.audioController.sampleRate = TestContent.GetPropertyInt("sample_rate");
    // show all logging
    subscribe.setLogLevel(R5Stream.LOG_LEVEL_DEBUG);
    subscribe.play(TestContent.GetPropertyString("stream1"));
    return super.onCreateView(inflater, container, savedInstanceState);
}
Also used : R5Configuration(com.red5pro.streaming.config.R5Configuration) R5Connection(com.red5pro.streaming.R5Connection) R5Stream(com.red5pro.streaming.R5Stream) R5AudioController(com.red5pro.streaming.media.R5AudioController)

Example 4 with R5AudioController

use of com.red5pro.streaming.media.R5AudioController in project streaming-android by red5pro.

the class SubscribeTwoStreamTest method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.double_view, container, false);
    // Create the configuration from the tests.xml
    R5Configuration config = new R5Configuration(R5StreamProtocol.RTSP, TestContent.GetPropertyString("host"), TestContent.GetPropertyInt("port"), TestContent.GetPropertyString("context"), TestContent.GetPropertyFloat("subscribe_buffer_time"));
    config.setLicenseKey(TestContent.GetPropertyString("license_key"));
    config.setBundleID(getActivity().getPackageName());
    R5Connection connection = new R5Connection(config);
    // setup a new stream using the connection
    subscribe = new R5Stream(connection);
    subscribe.setListener(this);
    subscribe.audioController = new R5AudioController();
    subscribe.audioController.sampleRate = TestContent.GetPropertyInt("sample_rate");
    // show all logging
    subscribe.setLogLevel(R5Stream.LOG_LEVEL_DEBUG);
    // find the view and attach the stream
    display = (R5VideoView) view.findViewById(R.id.videoView1);
    display.attachStream(subscribe);
    display.showDebugView(TestContent.GetPropertyString("debug_view").equals("true"));
    subscribe.play(TestContent.GetPropertyString("stream1"));
    secondDisplay = (R5VideoView) view.findViewById(R.id.videoView2);
    final R5ConnectionListener listener = this;
    final Handler root = new Handler(Looper.getMainLooper());
    new Thread(new Runnable() {

        @Override
        public void run() {
            try {
                Thread.sleep(4000);
                Looper.prepare();
                root.post(new Runnable() {

                    @Override
                    public void run() {
                        R5Configuration config2 = new R5Configuration(R5StreamProtocol.RTSP, TestContent.GetPropertyString("host"), TestContent.GetPropertyInt("port"), TestContent.GetPropertyString("context"), TestContent.GetPropertyFloat("subscribe_buffer_time"));
                        config2.setLicenseKey(TestContent.GetPropertyString("license_key"));
                        config2.setBundleID(getActivity().getPackageName());
                        R5Connection secondConnection = new R5Connection(config2);
                        secondSubscribe = new R5Stream(secondConnection);
                        secondSubscribe.setListener(listener);
                        secondDisplay.attachStream(secondSubscribe);
                        secondDisplay.showDebugView(TestContent.GetPropertyString("debug_view").equals("true"));
                        secondSubscribe.audioController = new R5AudioController();
                        secondSubscribe.audioController.sampleRate = TestContent.GetPropertyInt("sample_rate");
                        secondSubscribe.play(TestContent.GetPropertyString("stream2"));
                    }
                });
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }).start();
    return view;
}
Also used : R5ConnectionListener(com.red5pro.streaming.event.R5ConnectionListener) R5Configuration(com.red5pro.streaming.config.R5Configuration) R5Connection(com.red5pro.streaming.R5Connection) R5Stream(com.red5pro.streaming.R5Stream) Handler(android.os.Handler) R5AudioController(com.red5pro.streaming.media.R5AudioController) R5VideoView(com.red5pro.streaming.view.R5VideoView) View(android.view.View)

Example 5 with R5AudioController

use of com.red5pro.streaming.media.R5AudioController in project streaming-android by red5pro.

the class SubscribeStreamManagerTest method subscribeToManager.

private void subscribeToManager(String url) {
    // Create the configuration from the tests.xml
    R5Configuration config = new R5Configuration(R5StreamProtocol.RTSP, url, TestContent.GetPropertyInt("port"), TestContent.GetPropertyString("context"), TestContent.GetPropertyFloat("subscribe_buffer_time"));
    config.setLicenseKey(TestContent.GetPropertyString("license_key"));
    config.setBundleID(getActivity().getPackageName());
    R5Connection connection = new R5Connection(config);
    // setup a new stream using the connection
    subscribe = new R5Stream(connection);
    subscribe.setListener(this);
    subscribe.audioController = new R5AudioController();
    subscribe.audioController.sampleRate = TestContent.GetPropertyInt("sample_rate");
    // show all logging
    subscribe.setLogLevel(R5Stream.LOG_LEVEL_DEBUG);
    // find the view and attach the stream
    display.attachStream(subscribe);
    display.showDebugView(TestContent.GetPropertyBool("debug_view"));
    subscribe.play(TestContent.GetPropertyString("stream1"));
    edgeShow = new TextView(display.getContext());
    FrameLayout.LayoutParams position = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.BOTTOM);
    edgeShow.setLayoutParams(position);
    ((FrameLayout) display.getParent()).addView(edgeShow);
    edgeShow.setText("Connected to: " + url, TextView.BufferType.NORMAL);
    edgeShow.setBackgroundColor(Color.LTGRAY);
}
Also used : R5Configuration(com.red5pro.streaming.config.R5Configuration) R5Connection(com.red5pro.streaming.R5Connection) R5Stream(com.red5pro.streaming.R5Stream) FrameLayout(android.widget.FrameLayout) TextView(android.widget.TextView) R5AudioController(com.red5pro.streaming.media.R5AudioController)

Aggregations

R5Connection (com.red5pro.streaming.R5Connection)8 R5Stream (com.red5pro.streaming.R5Stream)8 R5Configuration (com.red5pro.streaming.config.R5Configuration)8 R5AudioController (com.red5pro.streaming.media.R5AudioController)8 FrameLayout (android.widget.FrameLayout)2 TextView (android.widget.TextView)2 Handler (android.os.Handler)1 View (android.view.View)1 R5ConnectionListener (com.red5pro.streaming.event.R5ConnectionListener)1 R5VideoView (com.red5pro.streaming.view.R5VideoView)1