forked from kaltura/playkit-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add playSessionId to playManifest URLs (kaltura#196)
* UrlDecorator allows "decorating" (changing) a URL before usage. PKMediaConfig now has a UrlDecorator field -- app can set it per media. * PlayManifestSessionIdDecorator -- UrlDecorator that adds playSessionId to playManifest URLs. * Moved sessionId value from PlayManifestSessionIdDecorator to PlayerController (Player.getSessionId()). * Moved urlDecorator instance from PKMediaConfig to Player. * Replaced UrlDecorator with RequestInfo.Decorator. RequestInfo contains url and headers. The decorator allows changing both. Added Player.Settings. Allows changing player behavior -- for now only setting contentRequestDecorator. * Rename PlayManifestSessionIdDecorator to KalturaPlaybackRequestDecorator. * PlayerLoader: set contentRequestDecorator to KalturaPlaybackRequestDecorator. * fix coach * Removed Player.Settings getter and added javadoc. * Moved KalturaPlaybackRequestDecorator to plugins.playback package. * Added a plugin that wraps KalturaPlaybackRequestDecorator. * Remove KalturaPlaybackUrlPlugin. It's not needed. * Encapsulate KalturaPlaybackRequestDecorator setup. * Made the request decorator's constructor private.
- Loading branch information
Showing
12 changed files
with
247 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,4 @@ public PKMediaConfig setMediaEntry(PKMediaEntry mediaEntry) { | |
return this; | ||
} | ||
} | ||
|
38 changes: 38 additions & 0 deletions
38
playkit/src/main/java/com/kaltura/playkit/PKRequestInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.kaltura.playkit; | ||
|
||
import android.net.Uri; | ||
|
||
import java.util.Map; | ||
|
||
public class PKRequestInfo { | ||
|
||
private Uri url; | ||
private Map<String, String> headers; | ||
|
||
public PKRequestInfo(Uri url, Map<String, String> headers) { | ||
this.url = url; | ||
this.headers = headers; | ||
} | ||
|
||
public Uri getUrl() { | ||
return url; | ||
} | ||
|
||
public PKRequestInfo setUrl(Uri url) { | ||
this.url = url; | ||
return this; | ||
} | ||
|
||
public Map<String, String> getHeaders() { | ||
return headers; | ||
} | ||
|
||
public PKRequestInfo setHeaders(Map<String, String> headers) { | ||
this.headers = headers; | ||
return this; | ||
} | ||
|
||
public interface Decorator { | ||
PKRequestInfo getRequestInfo(PKRequestInfo requestInfo); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
playkit/src/main/java/com/kaltura/playkit/player/PKMediaSourceConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.kaltura.playkit.player; | ||
|
||
import android.net.Uri; | ||
|
||
import com.kaltura.playkit.PKMediaSource; | ||
import com.kaltura.playkit.PKRequestInfo; | ||
|
||
/** | ||
* Created by Noam Tamim @ Kaltura on 29/03/2017. | ||
*/ | ||
class PKMediaSourceConfig { | ||
PKMediaSource mediaSource; | ||
PKRequestInfo.Decorator decorator; | ||
|
||
PKMediaSourceConfig(PKMediaSource mediaSource, PKRequestInfo.Decorator decorator) { | ||
this.mediaSource = mediaSource; | ||
this.decorator = decorator; | ||
} | ||
|
||
Uri getUrl() { | ||
Uri uri = Uri.parse(mediaSource.getUrl()); | ||
if (decorator == null) { | ||
return uri; | ||
} else { | ||
return decorator.getRequestInfo(new PKRequestInfo(uri, null)).getUrl(); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
PKMediaSourceConfig that = (PKMediaSourceConfig) o; | ||
|
||
if (mediaSource != null ? !mediaSource.equals(that.mediaSource) : that.mediaSource != null) | ||
return false; | ||
return decorator != null ? decorator.equals(that.decorator) : that.decorator == null; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = mediaSource != null ? mediaSource.hashCode() : 0; | ||
result = 31 * result + (decorator != null ? decorator.hashCode() : 0); | ||
return result; | ||
} | ||
} |
Oops, something went wrong.