Skip to content

Commit

Permalink
moved host ip and port to strings.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
pchab committed Apr 29, 2014
1 parent 9d33331 commit 06236e7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-sdk
android:minSdkVersion="8"
android:minSdkVersion="13"
android:targetSdkVersion="18" />

<uses-permission android:name="android.permission.CAMERA" />
Expand Down
7 changes: 3 additions & 4 deletions AndroidRTC.iml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
</content>
<orderEntry type="jdk" jdkName="Android 4.2.2 Platform" jdkType="Android SDK" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="lib_android_websockets" level="project" />
<orderEntry type="library" name="libjingle_peerconnection" level="project" />
<orderEntry type="library" name="libs" level="project" />
</component>
</module>

3 changes: 2 additions & 1 deletion res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">AndroidRTC</string>
<string name="host">54.214.218.3</string>
<string name="host">172.20.102.34</string>
<string name="port">3000</string>
</resources>
8 changes: 5 additions & 3 deletions src/fr/pchab/AndroidRTC/RTCActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,27 @@
import java.util.List;

public class RTCActivity extends Activity implements WebRtcClient.RTCListener{
private final String HOST = "http://54.214.218.3:3000/";
private final static int VIDEO_CALL_SENT = 666;
private VideoStreamsView vsv;
private WebRtcClient client;
private String mSocketAddress;
private String callerId;


@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
mSocketAddress = "http://" + getResources().getString(R.string.host);
mSocketAddress += (":"+getResources().getString(R.string.port)+"/");

PeerConnectionFactory.initializeAndroidGlobals(this);

// Camera display view
Point displaySize = new Point();
getWindowManager().getDefaultDisplay().getSize(displaySize);
vsv = new VideoStreamsView(this, displaySize);
client = new WebRtcClient(this, HOST);
client = new WebRtcClient(this, mSocketAddress);

final Intent intent = getIntent();
final String action = intent.getAction();
Expand Down Expand Up @@ -83,7 +85,7 @@ public void answer(String callerId) throws JSONException {

public void call(String callId) {
Intent msg = new Intent(Intent.ACTION_SEND);
msg.putExtra(Intent.EXTRA_TEXT, HOST + callId);
msg.putExtra(Intent.EXTRA_TEXT, mSocketAddress + callId);
msg.setType("text/plain");
startActivityForResult(Intent.createChooser(msg, "Call someone :"), VIDEO_CALL_SENT);
}
Expand Down
6 changes: 6 additions & 0 deletions src/fr/pchab/AndroidRTC/WebRtcClient.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package fr.pchab.AndroidRTC;

import android.os.Handler;
import android.util.Log;
import com.koushikdutta.async.http.socketio.Acknowledge;
import com.koushikdutta.async.http.socketio.ConnectCallback;
import com.koushikdutta.async.http.socketio.EventCallback;
Expand All @@ -14,6 +15,7 @@
import java.util.LinkedList;

class WebRtcClient {
private final static String TAG = WebRtcClient.class.getCanonicalName();
private final static int MAX_PEER = 2;
private boolean[] endPoints = new boolean[MAX_PEER];
private PeerConnectionFactory factory;
Expand Down Expand Up @@ -222,6 +224,10 @@ public Peer(String id, int endPoint) {
}

public WebRtcClient(RTCListener listener, String host) {


Log.d(TAG, "WebRtcClient creation.");

mListener = listener;
factory = new PeerConnectionFactory();

Expand Down

0 comments on commit 06236e7

Please sign in to comment.