Skip to content

Commit

Permalink
HLS media source
Browse files Browse the repository at this point in the history
  • Loading branch information
kristurek committed Feb 16, 2023
1 parent e5b131c commit 75fd01b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ android {
applicationId "com.kristurek.polskatv"
minSdkVersion 22
targetSdkVersion 28
versionCode 117
versionName "117"
versionCode 118
versionName "118"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
buildConfigField "String", "DROPBOX_TOKEN", "\""+getDropboxToken()+"\""
Expand Down Expand Up @@ -102,6 +102,7 @@ dependencies {

implementation 'com.google.android.exoplayer:exoplayer-core:2.16.1'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.16.1'
implementation 'com.google.android.exoplayer:exoplayer-hls:2.16.1'

implementation 'com.google.android.material:material:1.4.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public LoginResponse login(LoginRequest request) throws IptvException {

persistRequest(request);

LoginResponse response = process(new LoginConverter(), () -> api.login(request.getLogin(), request.getPass(), "all", "polwin-jo-001", "b9007bc2ca5768442a3fa4c41f14a4fb", "en"));
LoginResponse response = process(new LoginConverter(), () -> api.login(request.getLogin(), request.getPass(), "all", "polwin-jo-001", "b9007bc2ca5768442a3fa4c41f14a4fb", "en", "apple"));

if (response.getRestOfDay() == 0)
throw new IptvSubscriptionExpiredException(ExceptionHelper.SUBSCRIPTION_EXPIRED_MSG);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Call<BaseRetrofitResponse> login(@Field("login") String login,
@Field("settings") String settings,
@Field("softid") String softId,
@Field("cli_serial") String cliSerial,
@Field("lang") String lang);
@Field("lang") String lang,
@Field("device") String device);

@TargetClass(clazz = LogoutRetrofitResponse.class)
@GET("/api/json/logout")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.source.hls.HlsMediaSource;
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.ExoTrackSelection;
Expand Down Expand Up @@ -244,10 +245,14 @@ private void postProcessAfterInitializationUrl(PlayerModel result) {
.setConnectTimeoutMs(CONNECT_TIMEOUT)
.setReadTimeoutMs(READ_TIMEOUT);

MediaSource source = new ProgressiveMediaSource.Factory(httpDataSourceFactory).createMediaSource(MediaItem.fromUri(uri));
//MediaSource source = new ProgressiveMediaSource.Factory(httpDataSourceFactory).createMediaSource(MediaItem.fromUri(uri));

HlsMediaSource hlsMediaSource =
new HlsMediaSource.Factory(httpDataSourceFactory)
.createMediaSource(MediaItem.fromUri(uri));

player.postValue(internalPlayer);
internalPlayer.setMediaSource(source);
internalPlayer.setMediaSource(hlsMediaSource);
internalPlayer.prepare();

timeline = new PlayerTimeline(result.getEpgCurrentTime());
Expand Down

0 comments on commit 75fd01b

Please sign in to comment.