use of com.red5pro.streaming.R5Stream in project streaming-android by red5pro.
the class SubscribeReconnectTest method SetupListener.
public void SetupListener() {
final R5ConnectionListener additionalListener = this;
final SubscribeReconnectTest subscribeTest = this;
final R5Stream subscriber = this.subscribe;
final R5VideoView view = this.display;
subscribe.setListener(new R5ConnectionListener() {
@Override
public void onConnectionEvent(R5ConnectionEvent r5ConnectionEvent) {
final R5ConnectionListener me = this;
additionalListener.onConnectionEvent(r5ConnectionEvent);
if (r5ConnectionEvent == R5ConnectionEvent.CLOSE && !SubscribeReconnectTest.this.stopped) {
Handler h = new Handler(Looper.getMainLooper());
h.postDelayed(new Runnable() {
@Override
public void run() {
if (!stopped) {
subscribeTest.findStreams();
}
}
}, reconnectDelay);
} else if (r5ConnectionEvent == R5ConnectionEvent.NET_STATUS && r5ConnectionEvent.message.equals("NetStream.Play.UnpublishNotify")) {
Handler h = new Handler(Looper.getMainLooper());
h.postDelayed(new Runnable() {
@Override
public void run() {
subscriber.setListener(null);
subscriber.stop();
view.attachStream(null);
subscribeTest.delayReconnect(reconnectDelay);
}
}, reconnectDelay);
}
}
});
}
use of com.red5pro.streaming.R5Stream in project streaming-android by red5pro.
the class PublishAuthTest method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.publish_test, container, false);
String auth = "username=" + TestContent.GetPropertyString("username") + ";";
auth += "password=" + TestContent.GetPropertyString("password") + ";";
// Create the configuration from the values.xml
R5Configuration config = new R5Configuration(R5StreamProtocol.RTSP, TestContent.GetPropertyString("host"), TestContent.GetPropertyInt("port"), TestContent.GetPropertyString("context"), TestContent.GetPropertyFloat("publish_buffer_time"), auth);
config.setLicenseKey(TestContent.GetPropertyString("license_key"));
config.setBundleID(getActivity().getPackageName());
R5Connection connection = new R5Connection(config);
// setup a new stream using the connection
publish = new R5Stream(connection);
publish.audioController.sampleRate = TestContent.GetPropertyInt("sample_rate");
publish.setListener(this);
// show all logging
publish.setLogLevel(R5Stream.LOG_LEVEL_DEBUG);
R5Camera camera = null;
if (TestContent.GetPropertyBool("video_on")) {
// attach a camera video source
cam = openFrontFacingCameraGingerbread();
cam.setDisplayOrientation((camOrientation + 180) % 360);
camera = new R5Camera(cam, TestContent.GetPropertyInt("camera_width"), TestContent.GetPropertyInt("camera_height"));
camera.setBitrate(TestContent.GetPropertyInt("bitrate"));
camera.setOrientation(camOrientation);
camera.setFramerate(TestContent.GetPropertyInt("fps"));
}
if (TestContent.GetPropertyBool("audio_on")) {
// attach a microphone
R5Microphone mic = new R5Microphone();
publish.attachMic(mic);
}
preview = (R5VideoView) rootView.findViewById(R.id.videoPreview);
preview.attachStream(publish);
if (TestContent.GetPropertyBool("video_on")) {
publish.attachCamera(camera);
}
preview.showDebugView(TestContent.GetPropertyBool("debug_view"));
publish.publish(TestContent.GetPropertyString("stream1"), R5Stream.RecordType.Record);
if (TestContent.GetPropertyBool("video_on")) {
cam.startPreview();
}
return rootView;
}
use of com.red5pro.streaming.R5Stream in project streaming-android by red5pro.
the class PublishHQAudioTest method publish.
@Override
protected void publish() {
String b = getActivity().getPackageName();
// Create the configuration from the values.xml
R5Configuration config = new R5Configuration(R5StreamProtocol.RTSP, TestContent.GetPropertyString("host"), TestContent.GetPropertyInt("port"), TestContent.GetPropertyString("context"), TestContent.GetPropertyFloat("publish_buffer_time"));
config.setLicenseKey(TestContent.GetPropertyString("license_key"));
config.setBundleID(b);
R5Connection connection = new R5Connection(config);
// setup a new stream using the connection
publish = new R5Stream(connection);
publish.audioController.sampleRate = TestContent.GetPropertyInt("sample_rate");
// show all logging
publish.setLogLevel(R5Stream.LOG_LEVEL_DEBUG);
if (TestContent.GetPropertyBool("video_on")) {
// attach a camera video source
cam = openFrontFacingCameraGingerbread();
cam.setDisplayOrientation((camOrientation + 180) % 360);
camera = new R5Camera(cam, TestContent.GetPropertyInt("camera_width"), TestContent.GetPropertyInt("camera_height"));
camera.setBitrate(TestContent.GetPropertyInt("bitrate"));
camera.setOrientation(camOrientation);
camera.setFramerate(TestContent.GetPropertyInt("fps"));
}
if (TestContent.GetPropertyBool("audio_on")) {
// attach a microphone
R5Microphone mic = new R5Microphone();
// kbps
mic.setBitRate(128);
// hz (samples/second)
R5AudioController.getInstance().sampleRate = 44100;
publish.attachMic(mic);
}
preview.attachStream(publish);
if (TestContent.GetPropertyBool("video_on"))
publish.attachCamera(camera);
preview.showDebugView(TestContent.GetPropertyBool("debug_view"));
publish.setListener(this);
publish.publish(TestContent.GetPropertyString("stream1"), R5Stream.RecordType.Live);
if (TestContent.GetPropertyBool("video_on"))
cam.startPreview();
}
use of com.red5pro.streaming.R5Stream in project streaming-android by red5pro.
the class SubscribeAuthTest method Subscribe.
public void Subscribe() {
String auth = "username=" + TestContent.GetPropertyString("username") + ";";
auth += "password=" + TestContent.GetPropertyString("password") + ";";
// 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"), auth);
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.audioController = new R5AudioController();
subscribe.audioController.sampleRate = TestContent.GetPropertyInt("sample_rate");
subscribe.client = this;
subscribe.setListener(this);
// show all logging
subscribe.setLogLevel(R5Stream.LOG_LEVEL_DEBUG);
// display.setZOrderOnTop(true);
display.attachStream(subscribe);
display.showDebugView(TestContent.GetPropertyBool("debug_view"));
subscribe.play(TestContent.GetPropertyString("stream1"));
}
Aggregations