Skip to content
This repository has been archived by the owner on Jun 5, 2021. It is now read-only.

Commit

Permalink
Crash Fixes in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Schultz committed Jun 29, 2018
1 parent db50b92 commit 0689896
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 71 deletions.
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,10 @@ allprojects {
jcenter()
}

}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked"
}
}

}
14 changes: 7 additions & 7 deletions constants.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
// limitations under the License.
project.ext {
// ExoPlayer version and version code.
releaseVersion = '2.8.7'
releaseVersionCode = 2807
releaseVersion = '2.8.8'
releaseVersionCode = 2808
// Important: ExoPlayer specifies a minSdkVersion of 14 because various
// components provided by the library may be of use on older devices.
// However, please note that the core media playback functionality provided
// by the library requires API level 16 or greater.
minSdkVersion = 24
targetSdkVersion = 28
compileSdkVersion = 28
buildToolsVersion = '28.0.0'
minSdkVersion = 26
targetSdkVersion = 26
compileSdkVersion = 27
buildToolsVersion = '27.0.3'
testSupportLibraryVersion = '0.5'
supportLibraryVersion = '28.0.0'
supportLibraryVersion = '27.0.3'
playServicesLibraryVersion = '12.0.0'
dexmakerVersion = '1.2'
mockitoVersion = '1.9.5'
Expand Down
4 changes: 2 additions & 2 deletions demos/main/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion project.ext.compileSdkVersion
buildToolsVersion project.ext.buildToolsVersion

defaultConfig {
versionName project.ext.releaseVersion
minSdkVersion 24
minSdkVersion 26
targetSdkVersion project.ext.targetSdkVersion
}

Expand All @@ -39,6 +38,7 @@ android {
disable 'MissingTranslation'
}

buildToolsVersion '27.0.3'
}

dependencies {
Expand Down
5 changes: 3 additions & 2 deletions demos/main/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="2807"
android:versionName="2.8.7"
android:versionCode="2808"
android:versionName="2.8.8-Roger"
package="com.foxsports.worldcup.streamtest">

<uses-permission android:name="android.permission.INTERNET"/>
Expand All @@ -27,6 +27,7 @@

<uses-feature android:name="android.software.leanback" android:required="true"/>
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
<uses-feature android:name="android.hardware.wifi" android:required="true" />
<uses-sdk/>

<application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.decoder.DecoderCounters;
import com.google.android.exoplayer2.source.hls.HlsManifest;

import java.util.Locale;

/**
Expand All @@ -36,6 +39,28 @@ public class DebugTracer extends Player.DefaultEventListener implements Runnable

private boolean started;


public void onTimelineChanged(Timeline timeline, Object manifest, int reason) {
Object x = manifest;
int windowCount = timeline.getWindowCount();

HlsManifest hlsManifest = (HlsManifest) manifest;


if (windowCount > 0) {
Timeline.Window lastWindow = new Timeline.Window();
timeline.getWindow(windowCount-1, lastWindow);

if (lastWindow.isDynamic) {

int segmentSize = hlsManifest.mediaPlaylist.segments.size();
long duration = hlsManifest.mediaPlaylist.targetDurationUs;
}

}
}


/**
* @param player The {@link SimpleExoPlayer} from which debug information should be obtained.
* @param textView The {@link TextView} that should be updated to display the information.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.C.ContentType;
import com.google.android.exoplayer2.DefaultLoadControl;
import com.google.android.exoplayer2.DefaultLoadControl.Builder;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.DefaultRenderersFactory;
import com.google.android.exoplayer2.ExoPlaybackException;
Expand All @@ -62,6 +63,7 @@
import com.google.android.exoplayer2.source.dash.DefaultDashChunkSource;
import com.google.android.exoplayer2.source.dash.manifest.DashManifestParser;
import com.google.android.exoplayer2.source.dash.manifest.RepresentationKey;
import com.google.android.exoplayer2.source.hls.HlsManifest;
import com.google.android.exoplayer2.source.hls.HlsMediaSource;
import com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistParser;
import com.google.android.exoplayer2.source.hls.playlist.RenditionKey;
Expand Down Expand Up @@ -398,6 +400,12 @@ private void initializePlayer() {
trackSelector.setParameters(trackSelectorParameters);
lastSeenTrackGroupArray = null;

// Builder
DefaultLoadControl.Builder builder = new DefaultLoadControl.Builder();

builder.setBufferDurationsMs(15000,50000,2500,5000);
builder.setPrioritizeTimeOverSizeThresholds(true);
// builder.setTargetBufferBytes()
player = ExoPlayerFactory.newSimpleInstance(renderersFactory, trackSelector, new DefaultLoadControl(), drmSessionManager);

player.addListener(new PlayerEventListener() {
Expand All @@ -406,6 +414,8 @@ public void onTimelineChanged(Timeline timeline, Object manifest, int reason) {
Object x = manifest;
int windowCount = timeline.getWindowCount();

HlsManifest hlsManifest = (HlsManifest) manifest;


if (windowCount > 0) {
Timeline.Window lastWindow = new Timeline.Window();
Expand All @@ -418,8 +428,6 @@ public void onTimelineChanged(Timeline timeline, Object manifest, int reason) {
liveTextView.setVisibility(View.GONE);
}



}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.util.JsonReader;
import android.os.Build;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -46,22 +45,17 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Locale;
import java.util.Collections;
import java.util.List;
import java.time.format.TextStyle;
import java.util.HashMap;
import java.util.Map;
import java.io.UnsupportedEncodingException;

import android.view.View.OnKeyListener;
import android.view.KeyEvent;
import android.view.inputmethod.InputMethodManager;
import java.time.format.DateTimeFormatter;
import java.time.ZonedDateTime;
import java.util.TimeZone;
import com.android.volley.Request;
Expand Down Expand Up @@ -93,7 +87,7 @@ public void onCreate(Bundle savedInstanceState) {
sampleListView.setAdapter(sampleAdapter);
sampleListView.setItemsCanFocus(true);

Intent intent = getIntent();
Intent intent = getIntent();
String dataUri = intent.getDataString();

String[] uris;
Expand All @@ -105,9 +99,7 @@ public void onCreate(Bundle savedInstanceState) {
try {
for (String asset : assetManager.list("")) {
if (asset.endsWith(".exolist.json")) {
// uriList.add("http://hisense-fox.azurewebsites.net/streamtest/media.exolist.json");
uriList.add("asset:///" + asset);

uriList.add("http://hisense-fox.azurewebsites.net/streamtest/media.exolist.json");
}
}
} catch (IOException e) {
Expand Down Expand Up @@ -296,7 +288,6 @@ private Sample readEntry(JsonReader reader, boolean insidePlaylist) throws IOExc
editable = reader.nextBoolean();
break;
case "startDateTime":
// startDateTime = ZonedDateTime.parse(reader.nextString(), dtFormatter);
reader.nextString();
break;
case "extension":
Expand Down Expand Up @@ -487,7 +478,7 @@ public void onResponse(JSONObject response) {
((UriSample) sample).uri = Uri.parse(tokenizedUrl);

samplePlayButton.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.holo_green_dark));

samplePlayButton.requestFocus();

}
catch (JSONException exc) {
Expand Down Expand Up @@ -519,7 +510,7 @@ public String getBodyContentType() {
/** Passing some request headers* */
@Override
public Map<String,String> getHeaders() throws AuthFailureError {
HashMap<String,String> headers = new HashMap();
HashMap<String,String> headers = new HashMap<String,String>();
headers.put("Content-Type", "application/json");
headers.put("Referer", "https://api.foxsports.com/dev-hbs-wcfox-tal/api.foxsports.com");
return headers;
Expand All @@ -537,7 +528,6 @@ public byte[] getBody() {
}
};


// Access the RequestQueue through your singleton class.
MySingleton.getInstance(getApplicationContext()).addToRequestQueue(jsonObjectRequest);

Expand Down Expand Up @@ -614,12 +604,6 @@ public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}


public void hideKeyboard(View view) {
InputMethodManager inputMethodManager =(InputMethodManager)getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(),InputMethodManager.HIDE_IMPLICIT_ONLY );
}

private void initializeChildView(View view, final Sample sample) {

// Set Tag to Item
Expand All @@ -629,32 +613,6 @@ private void initializeChildView(View view, final Sample sample) {
TextView sampleTitle = view.findViewById(R.id.sample_title);
sampleTitle.setText(sample.name);

// Reference the Start Date/Time TextView
// TextView sampleStartDateTime = view.findViewById(R.id.sample_startDateTime);

// Set the Start Date/Time value, if available
if (((UriSample) sample).startDateTime != null)
{
// Get the TV's local time zone
TimeZone localZone = TimeZone.getDefault();

// Get the TV's local time zone ID
// ZoneId localZoneId = localZone.toZoneId();

// Get the IBC Time Zone from the start date/time
ZonedDateTime ibcDateTime = ((UriSample) sample).startDateTime;

// Get a short time format
// DateTimeFormatter timeFormat = DateTimeFormatter.ofPattern("HH:mm a ");

// Set the start date/time with the formatter
// sampleStartDateTime.setText(ibcDateTime.withZoneSameInstant(localZoneId).toLocalTime().format(timeFormat) + localZoneId.getDisplayName(TextStyle.FULL, Locale.US));
}
else {
// Set it to blank
// sampleStartDateTime.setText("");
}

// Reference the Views
final TextView sampleUri = view.findViewById(R.id.sample_uri);
final EditText sampleUriEdit = view.findViewById(R.id.sample_uri_edit);
Expand All @@ -664,18 +622,20 @@ private void initializeChildView(View view, final Sample sample) {
// Cast to UriSample
UriSample uriSample = ((UriSample) sample);

// Set the text values
sampleUri.setText(uriSample.uri.toString());
sampleUriEdit.setText(uriSample.uri.toString());
if (uriSample != null) {
// Set the text values
sampleUri.setText(uriSample.uri.toString());
sampleUriEdit.setText(uriSample.uri.toString());

if (uriSample.editable) {
if (uriSample.editable) {
sampleUri.setVisibility(View.GONE);
sampleUriEdit.setVisibility(View.VISIBLE);
playButton.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.holo_green_dark));
}
else {
}
else {
sampleUri.setVisibility(View.VISIBLE);
sampleUriEdit.setVisibility(View.GONE);
}
}

}
Expand Down
9 changes: 4 additions & 5 deletions demos/main/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">

<string name="application_name">4️⃣𝐊📅⏰📺📡️⚽️🌏🇷🇺🏆🦊</string>
<string name="test_stream">https://fifa2018-i.akamaihd.net/hls/live/652796/652796_DN_0614-fox/master.m3u8</string>
<string name="play_button">Play</string>
<string name="tokenize_button">🎟</string>

Expand Down Expand Up @@ -50,15 +49,15 @@

<string name="tokenize_error">Tokenization request failed.</string>

<string name="ima_not_loaded">Playing sample without ads, as the IMA extension was not loaded</string>
<string name="ima_not_loaded">Playing without ads, as the IMA extension was not loaded</string>

<string name="download_start_error">Failed to start download</string>

<string name="download_playlist_unsupported">This demo app does not support downloading playlists</string>
<string name="download_playlist_unsupported">This app does not support downloading playlists</string>

<string name="download_drm_unsupported">This demo app does not support downloading protected content</string>
<string name="download_drm_unsupported">This app does not support downloading protected content</string>

<string name="download_scheme_unsupported">This demo app only supports downloading http streams</string>
<string name="download_scheme_unsupported">This app only supports downloading http streams</string>

<string name="download_ads_unsupported">IMA does not support offline ads</string>

Expand Down

0 comments on commit 0689896

Please sign in to comment.