Skip to content

Commit

Permalink
first working implementation of streaming media on android
Browse files Browse the repository at this point in the history
  • Loading branch information
beqabeqa473 committed Aug 9, 2018
1 parent 06b60a3 commit 7209d17
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Expand Up @@ -36,6 +36,7 @@
import dk.bearware.ClientErrorMsg;
import dk.bearware.ClientFlag;
import dk.bearware.ClientStatistics;
import dk.bearware.Codec;
import dk.bearware.DesktopInput;
import dk.bearware.FileTransfer;
import dk.bearware.MediaFileInfo;
Expand All @@ -49,6 +50,7 @@
import dk.bearware.UserAccount;
import dk.bearware.UserRight;
import dk.bearware.UserState;
import dk.bearware.VideoCodec;
import dk.bearware.data.Permissions;
import dk.bearware.events.ClientListener;
import dk.bearware.events.CommandListener;
Expand Down Expand Up @@ -156,7 +158,8 @@ public class MainActivity
public final int REQUEST_EDITCHANNEL = 1,
REQUEST_NEWCHANNEL = 2,
REQUEST_EDITUSER = 3,
REQUEST_SELECT_FILE = 4;
REQUEST_SELECT_FILE = 4,
REQUEST_STREAM_MEDIA = 5;

// The channel currently being displayed
Channel curchannel;
Expand Down Expand Up @@ -271,6 +274,7 @@ public boolean onPrepareOptionsMenu(Menu menu) {
menu.findItem(R.id.action_edit).setEnabled(isEditable).setVisible(isEditable);
menu.findItem(R.id.action_join).setEnabled(isJoinable).setVisible(isJoinable);
menu.findItem(R.id.action_upload).setEnabled(isMyChannel).setVisible(isMyChannel);
menu.findItem(R.id.action_stream).setEnabled(isMyChannel).setVisible(isMyChannel);
return super.onPrepareOptionsMenu(menu);
}

Expand All @@ -288,6 +292,12 @@ public boolean onOptionsItemSelected(MenuItem item) {
}
}
break;
case R.id.action_stream : {
if (Permissions.setupPermission(getBaseContext(), this, Permissions.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE)) {
startActivityForResult(new Intent(this, FilePickerActivity.class), REQUEST_STREAM_MEDIA);
}
}
break;
case R.id.action_edit : {
if (curchannel != null)
editChannelProperties(curchannel);
Expand Down Expand Up @@ -511,6 +521,11 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
else {
Toast.makeText(this, R.string.upload_started, Toast.LENGTH_SHORT).show();
}
} else if ((requestCode == REQUEST_STREAM_MEDIA) && (resultCode == RESULT_OK)) {
String path = data.getStringExtra(FilePickerActivity.SELECTED_FILE);
VideoCodec videocodec = new VideoCodec();
videocodec.nCodec = Codec.NO_CODEC;
ttclient.startStreamingMediaFileToChannel(path, videocodec);
}
}

Expand Down
4 changes: 4 additions & 0 deletions Client/TeamTalkAndroid/src/main/res/menu/main.xml
Expand Up @@ -14,6 +14,10 @@
android:id="@+id/action_upload"
android:showAsAction="ifRoom|withText"
android:title="@string/action_upload"/>
<item
android:id="@+id/action_stream"
android:showAsAction="ifRoom|withText"
android:title="@string/action_stream"/>
<item
android:id="@+id/action_edit"
android:showAsAction="ifRoom|withText"
Expand Down
1 change: 1 addition & 0 deletions Client/TeamTalkAndroid/src/main/res/values/strings.xml
Expand Up @@ -124,6 +124,7 @@
<string name="action_move">Move Here</string>
<string name="action_select">Select For Move</string>
<string name="action_upload">Upload File</string>
<string name="action_stream">Stream a media file</string>
<string name="button_msg">Msg</string>
<string name="button_send">Send</string>

Expand Down

0 comments on commit 7209d17

Please sign in to comment.