Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
53 changes: 33 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
# built application files
#.apk
*.ap_

*.class

*.apk

DemoApplication/bin/*

KalturaClient/bin/*

KalturaClientTester/bin/*

# files for the dex VM
*.dex

DemoApplication/gen/com/kaltura/activity/R.java

DemoApplication/gen/com/kaltura/activity/R.java

DemoApplication/gen/com/kaltura/client/R.java

KalturaClient/gen/com/kaltura/client/R.java

KalturaClientTester/gen/com/kaltura/client/R.java
# Java class files
*.class

DemoApplication.zip
# generated files
bin/
gen/
playerSDK/build/
kalturaPlay/build/
hLSPlayerSDK/build/
googlemediaframework/build/
exoPlayerLib/build/
castCompanionLibraryandroid/build/
build/
.navigation/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Intellij project files
*.iml
#*.ipr
#*.iws
.idea/

.idea/workspace.xml
.gradle
2 changes: 1 addition & 1 deletion DemoApplication/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<classpath>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
Binary file added DemoApplication/aars/playerSDK-release.aar
Binary file not shown.
30 changes: 30 additions & 0 deletions DemoApplication/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

packagingOptions {
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
}

defaultConfig {
applicationId "com.kaltura.demoapplication"
minSdkVersion 15
targetSdkVersion 21
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile(name:'playerSDK-release', ext:'aar')
compile project(':KalturaClient')
}
6 changes: 4 additions & 2 deletions DemoApplication/gen/com/kaltura/activity/BuildConfig.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/** Automatically generated file. DO NOT MODIFY */
/*___Generated_by_IDEA___*/

package com.kaltura.activity;

/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
public final class BuildConfig {
public final static boolean DEBUG = true;
public final static boolean DEBUG = Boolean.parseBoolean(null);
}
Binary file removed DemoApplication/libs/android-support-v4.jar
Binary file not shown.
Binary file removed DemoApplication/libs/commons-codec-1.4.jar
Binary file not shown.
Binary file removed DemoApplication/libs/commons-httpclient-3.1.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions DemoApplication/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
# project structure.

# Project target.
target=android-17
target=android-19
android.library=false
android.library.reference.1=../KalturaClient
android.library.reference.2=../../player-sdk-android/PlayerSDK
Empty file.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.kaltura.activity;

import java.util.Iterator;
import java.util.List;

import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
Expand All @@ -14,6 +11,9 @@
import com.kaltura.playersdk.PlayerViewController;
import com.kaltura.playersdk.events.OnToggleFullScreenListener;

import java.util.Iterator;
import java.util.List;

/**
* This Helper class will perform kaltura-player related actions
* @author michalradwantzor
Expand Down Expand Up @@ -56,7 +56,7 @@ public void showPlayer(String entryId, String partnerId, int width, int height,
mWidth = width;
mHeight = height;
mPlayerView.setPlayerViewDimensions(width, height);
mPlayerView.addComponents(partnerId, entryId, mActivity);
// mPlayerView.setComponents(partnerId, entryId, mActivity);
}

public void setLayout(LinearLayout layout) {
Expand Down Expand Up @@ -104,7 +104,7 @@ private void openFullscreen() {
Point size = new Point();
mActivity.getWindowManager().getDefaultDisplay().getSize(size);
if ( mLayout != null ) {
LayoutParams params = (LayoutParams) mLayout.getLayoutParams();
LayoutParams params = mLayout.getLayoutParams();
params.width = LayoutParams.MATCH_PARENT;
params.height = LayoutParams.MATCH_PARENT;
mLayout.invalidate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@
*/
package com.kaltura.services;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Observable;
import java.util.logging.Level;
import java.util.logging.Logger;

import android.os.Environment;
import android.util.Log;

Expand All @@ -22,6 +13,15 @@
import com.kaltura.client.types.KalturaUploadToken;
import com.kaltura.client.types.KalturaUploadedFileTokenResource;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Observable;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
* Upload files to the server
*/
Expand All @@ -33,8 +33,9 @@ public class UploadToken extends Observable {
private KalturaClient client;
private int setAttemptUpload;
private KalturaMediaEntry newEntry;
private float uploadedFileSize;
private float remainingUploadFileSize;
private boolean startUpload;
private int readSum = 0;

/**
* Constructor Description of UploadToken
Expand All @@ -47,8 +48,9 @@ public UploadToken(String TAG, int setAttemptUpload) {
fileData = new File(TAG);
this.setAttemptUpload = setAttemptUpload;
kalturaUploadToken = new KalturaUploadToken();
uploadedFileSize = kalturaUploadToken.uploadedFileSize;
remainingUploadFileSize = kalturaUploadToken.uploadedFileSize;
client = AdminUser.getClient();

}

/**
Expand Down Expand Up @@ -85,7 +87,7 @@ public void setStartUpload(boolean startUpload) {
*/
public boolean uploadMediaFileAndAttachToEmptyEntry(String TAG, KalturaMediaEntry entry, String pathfromURI) {
Log.w(TAG, "\nUploading a video file...");

readSum = 0;
fileData = new File(pathfromURI);

KalturaUploadToken upToken = null;
Expand Down Expand Up @@ -118,6 +120,11 @@ public boolean uploadMediaFileAndAttachToEmptyEntry(String TAG, KalturaMediaEntr
if (!errUpload) {
try {
Log.w(TAG, "Available bytes: " + fis.available());
remainingUploadFileSize = fis.available();
if(remainingUploadFileSize == 0){
uploaded = true;
break;
}
buf = new byte[sizeBuf];
numRead = fis.read(buf);
Log.w(TAG, "Readed bytes: " + numRead);
Expand All @@ -136,18 +143,21 @@ public boolean uploadMediaFileAndAttachToEmptyEntry(String TAG, KalturaMediaEntr
}

}
if (fileData.length() - kalturaUploadToken.uploadedFileSize > numRead) {
if (kalturaUploadToken.uploadedFileSize <= uploadedFileSize) {
if (addChunk(client, upToken.id, outFile, false, false, -1)) {
if (fileData.length() > sizeBuf) {
if (remainingUploadFileSize > sizeBuf) {
if (addChunk(client, upToken.id, outFile, readSum != 0, false, readSum)) {
Log.w(TAG, "1 chunk[" + ++i + "] - uploaddFileSize: " + kalturaUploadToken.uploadedFileSize);
wasFirst = true;
readSum += numRead;
} else {
Log.w(TAG, "error loading chunk!");
errUpload = true;
}
} else {
if (addChunk(client, upToken.id, outFile, true, false, -1)) {
if (addChunk(client, upToken.id, outFile, true, true, readSum)) {
Log.w(TAG, "n chunk[" + ++i + "] - uploaddFileSize: " + kalturaUploadToken.uploadedFileSize);
readSum += numRead;
uploaded = true;
} else {
Log.w(TAG, "error loading chunk!");
errUpload = true;
Expand Down Expand Up @@ -180,8 +190,7 @@ public boolean uploadMediaFileAndAttachToEmptyEntry(String TAG, KalturaMediaEntr
} while (!uploaded && !(attemptUpload >= setAttemptUpload) && startUpload);

Log.w(TAG, "HASH:" + new Float(kalturaUploadToken.uploadedFileSize).hashCode());
if (new Float(kalturaUploadToken.uploadedFileSize).hashCode() == new Float(fileData.length()).hashCode()) {
uploaded = true;
if (uploaded) {
startUpload = false;
try {
KalturaUploadedFileTokenResource fileTokenResource = new KalturaUploadedFileTokenResource();
Expand Down
2 changes: 1 addition & 1 deletion KalturaClient/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
22 changes: 22 additions & 0 deletions KalturaClient/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
minSdkVersion 15
targetSdkVersion 21
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
6 changes: 4 additions & 2 deletions KalturaClient/gen/com/kaltura/client/BuildConfig.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/** Automatically generated file. DO NOT MODIFY */
/*___Generated_by_IDEA___*/

package com.kaltura.client;

/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
public final class BuildConfig {
public final static boolean DEBUG = true;
public final static boolean DEBUG = Boolean.parseBoolean(null);
}
2 changes: 1 addition & 1 deletion KalturaClient/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-17
target=android-19
android.library=true
Loading