Skip to content

Commit

Permalink
removed sample files from library. error thrown when not able to conn…
Browse files Browse the repository at this point in the history
…ect.
  • Loading branch information
hishamMuneer committed Nov 1, 2018
1 parent 13d3c08 commit 8f4db5d
Show file tree
Hide file tree
Showing 7 changed files with 232 additions and 149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import com.google.android.exoplayer2.util.Util;
import com.vocabimate.protocol.AesEncryptionUtil;
import com.vocabimate.protocol.ILicenceTo;
import com.vocabimate.helpers.LicenceBody;
import com.google.android.exoplayer2.demo.helpers.LicenceBody;

import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -167,15 +167,15 @@ public ILicenceTo getKeyHelper(long videoId, UriSample sample, String localEncKe
// While Playing

if(sample.uri.toString().contains("vid5_seg")) {
return new LicenceBody(75, 20, "N",
return new LicenceBody("vid5_seg", 75, 20, "N",
"http://54.152.186.92:60801/drm/videoServer/Video/inayat/vid5_seg/playlist.m3u8",
TOKEN,
"http://54.152.186.92:60801/license/create_license", localEncKey, localEncIV
);
}

if(sample.uri.toString().contains("vid3_seg"))
return new LicenceBody(75, 18, "N",
return new LicenceBody("vid3_seg", 75, 18, "N",
"http://54.152.186.92:60801/drm/videoServer/Video/inayat/vid3_seg/playlist.m3u8",
TOKEN,
"http://54.152.186.92:60801/license/create_license", localEncKey, localEncIV
Expand All @@ -184,7 +184,7 @@ public ILicenceTo getKeyHelper(long videoId, UriSample sample, String localEncKe


if(sample.uri.toString().contains("vid2_seg"))
return new LicenceBody(75, 1, "N",
return new LicenceBody("vid2_seg", 75, 1, "N",
"http://54.152.186.92:60801/drm/videoServer/Video/inayat/vid2_seg/playlist.m3u8",
TOKEN,
"http://54.152.186.92:60801/license/create_license", localEncKey, localEncIV
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
package com.google.android.exoplayer2.demo.helpers;

import com.vocabimate.protocol.ILicenceContract;

import java.io.Serializable;
import java.util.Date;

/**
* Created by Hisham on 29/Oct/2018 - 21:08
*/
public class Licence implements ILicenceContract, Serializable {

private int userId;
private int videoId;
private String decryptionKey;
private Date validateDt;
private Date createDt;
private String createUserId;
private Date updateDt;
private String updateUserId;
private String delInd;
private long expTime;//long videoOfflineExpiryTime();
private long serverTime;// long serverTime();
private VideoSubscription videoSubscription;
private int gracePeriod; //long gracePeriodInMillis();
private long videoProviderExpiryTime;//long videoProviderExpiryTime();


public int getGracePeriod() {
return gracePeriod;
}

public void setGracePeriod(int gracePeriod) {
this.gracePeriod = gracePeriod;
}

public int getUserId() {
return userId;
}

public void setUserId(int userId) {
this.userId = userId;
}

public int getVideoId() {
return videoId;
}

public void setVideoId(int videoId) {
this.videoId = videoId;
}

public Date getValidateDt() {
return validateDt;
}

public void setValidateDt(Date validateDt) {
this.validateDt = validateDt;
}

public Date getCreateDt() {
return createDt;
}

public void setCreateDt(Date createDt) {
this.createDt = createDt;
}

public String getCreateUserId() {
return createUserId;
}

public void setCreateUserId(String createUserId) {
this.createUserId = createUserId;
}

public Date getUpdateDt() {
return updateDt;
}

public void setUpdateDt(Date updateDt) {
this.updateDt = updateDt;
}

public String getUpdateUserId() {
return updateUserId;
}

public void setUpdateUserId(String updateUserId) {
this.updateUserId = updateUserId;
}

public String getDelInd() {
return delInd;
}

public void setDelInd(String delInd) {
this.delInd = delInd;
}

public String getDecryptionKey() {
return decryptionKey;
}

public long getVideoProviderExpiryTime() {
return videoProviderExpiryTime;
}

public void setVideoProviderExpiryTime(long videoProviderExpiryTime) {
this.videoProviderExpiryTime = videoProviderExpiryTime;
}

public void setDecryptionKey(String decryptionKey) {
this.decryptionKey = decryptionKey;
}

public long getExpTime() {
return expTime;
}

public void setExpTime(long expTime) {
this.expTime = expTime;
}



public void setServerTime(long serverTime) {
this.serverTime = serverTime;
}

public long getServerTime() {
return serverTime;
}

public VideoSubscription getVideoSubscription() {
return videoSubscription;
}

public void setVideoSubscription(VideoSubscription videoSubscription) {
this.videoSubscription = videoSubscription;
}

@Override
public String toString() {
return "LicenseFile [userId=" + userId + ", videoId=" + videoId + ", decryptionKey=" + decryptionKey
+ ", validateDt=" + validateDt + ", createDt=" + createDt + ", createUserId=" + createUserId
+ ", updateDt=" + updateDt + ", updateUserId=" + updateUserId + ", delInd=" + delInd + ", expTime="
+ expTime + ", serverTime=" + serverTime + ", videoSubscription=" + videoSubscription + "]";
}



}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.vocabimate.helpers;
package com.google.android.exoplayer2.demo.helpers;

import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
Expand All @@ -13,56 +13,56 @@
public class LicenceBody extends KeyHelper implements Serializable {

@SerializedName("licenseTO")
private LicenceBodyInternal licenceBodyInternal;
private LicenceBody.LicenceBodyInternal licenceBodyInternal;
private String videoName;

public LicenceBody(int userId, int videoId, String delInd, String m3u8Path, String token, String licenceUrl, String localEncryptionKey, String localEncryptionIV) {
public LicenceBody(String videoName, int userId, int videoId, String delInd, String m3u8Path, String token, String licenceUrl, String localEncryptionKey, String localEncryptionIV) {
super(m3u8Path, token, licenceUrl, localEncryptionKey, localEncryptionIV);
licenceBodyInternal = new LicenceBodyInternal(userId, videoId, delInd);
this.licenceBodyInternal = new LicenceBody.LicenceBodyInternal(userId, videoId, delInd);
this.videoName = videoName;
}

@Override
public String getVideoName() {
return videoName;
}


public String jsonBody() {
return new Gson().toJson(this);
return (new Gson()).toJson(this);
}

@Override
public String getRequestType() {
return "POST";
}

public int getVideoId() {
return licenceBodyInternal.videoId;
return this.licenceBodyInternal.videoId;
}

public int getUserId() {
return licenceBodyInternal.userId;
return this.licenceBodyInternal.userId;
}

/**
* @return Unique key path to append for every video ex: vcb://{videoId} that will become- vcb://18 or vcb://360p.m3u8/18, just it should be unique
*/
@Override
public String getUniqueKeyPathForVCB() {
return String.valueOf(licenceBodyInternal.videoId);
return String.valueOf(this.licenceBodyInternal.videoId);
}

@Override
public Class<? extends ILicenceWrapperContract> getLicenceResponseModelClass() {
return LicenceModel.class;
}

private class LicenceBodyInternal implements Serializable {
public class LicenceBodyInternal implements Serializable {
@SerializedName("userId")
int userId;
@SerializedName("videoId")
int videoId;
@SerializedName("delInd")
String delInd;

/* package */ LicenceBodyInternal(int userId, int videoId, String delInd) {
LicenceBodyInternal(int userId, int videoId, String delInd) {
this.userId = userId;
this.videoId = videoId;
this.delInd = delInd;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
package com.vocabimate.helpers;
package com.google.android.exoplayer2.demo.helpers;

import com.google.gson.annotations.SerializedName;
import com.vocabimate.protocol.ILicenceWrapperContract;

import java.io.Serializable;

/**
* Created by Hisham on 16/Oct/2018 - 14:27
*/
public class LicenceModel implements ILicenceWrapperContract {

public class LicenceModel implements ILicenceWrapperContract, Serializable {
@SerializedName("licenseFile")
private Licence licenseFile;

public LicenceModel() {
}

public Licence getLicenseFile() {
return licenseFile;
return this.licenseFile;
}

public LicenceModel setLicenseFile(Licence licenseFile) {
this.licenseFile = licenseFile;
return this;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.google.android.exoplayer2.demo.helpers;

import java.io.Serializable;

/**
* Created by Hisham on 01/Nov/2018 - 19:48
*/
public class VideoSubscription implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private Long startDate;
private Long endDate;// long subscriptionEndTime();
public VideoSubscription() {
super();
}

public VideoSubscription(Long startDate, Long endDate) {
super();
this.startDate = startDate;
this.endDate = endDate;
}
public Long getStartDate() {
return startDate;
}
public void setStartDate(Long startDate) {
this.startDate = startDate;
}

public Long getEndDate() {
return endDate;
}
public void setEndDate(Long endDate) {
this.endDate = endDate;
}

@Override
public String toString() {
return "VideoSubscription [startDate=" + startDate + ", endDate=" + endDate + "]";
}
}
Loading

0 comments on commit 8f4db5d

Please sign in to comment.