Commit f81d71c775aaee719fb2c1a37928bf854d81b7ca
1 parent
6cb2d127
--no commit message
Showing
4 changed files
with
14 additions
and
2 deletions
res/xml/prefs.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > | 2 | <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > |
3 | <EditTextPreference android:key="server" android:title="@string/url" android:summary="@string/urlhint" android:defaultValue="@string/defaultURL"/> | 3 | <EditTextPreference android:key="server" android:title="@string/url" android:summary="@string/urlhint" android:defaultValue="@string/defaultURL"/> |
4 | - <ListPreference android:key="@string/selectorTitle" android:dialogTitle="@string/selectorTitle" android:entries="@array/selectorEntries" android:dialogMessage="@string/selectorSummary" android:entryValues="@array/selectorValues" android:title="@string/selectorTitle" android:summary="@string/selectorSummary"/> | 4 | + <ListPreference android:key="selector" android:dialogTitle="@string/selectorTitle" android:entries="@array/selectorEntries" android:dialogMessage="@string/selectorSummary" android:entryValues="@array/selectorValues" android:title="@string/selectorTitle" android:summary="@string/selectorSummary"/> |
5 | </PreferenceScreen> | 5 | </PreferenceScreen> |
6 | \ No newline at end of file | 6 | \ No newline at end of file |
src/com/upc/pbe/upcnews/HLS.java
@@ -29,11 +29,16 @@ public class HLS | @@ -29,11 +29,16 @@ public class HLS | ||
29 | Log.d(TAG, "Esborrat " + files[i].toString()); | 29 | Log.d(TAG, "Esborrat " + files[i].toString()); |
30 | deleteme.delete(); | 30 | deleteme.delete(); |
31 | } | 31 | } |
32 | - currentVideo = currentQuality = currentSegment = 0; | 32 | + |
33 | + currentVideo = currentSegment = 0; | ||
33 | this.videos = parsed; | 34 | this.videos = parsed; |
34 | endReached = false; | 35 | endReached = false; |
35 | } | 36 | } |
36 | 37 | ||
38 | + public void setQuality(int qual){ | ||
39 | + currentQuality = qual; | ||
40 | + } | ||
41 | + | ||
37 | public void loadVideo() | 42 | public void loadVideo() |
38 | { | 43 | { |
39 | // Carrega la qualitat i, a partir d'aixo, el seguent segment | 44 | // Carrega la qualitat i, a partir d'aixo, el seguent segment |
src/com/upc/pbe/upcnews/UpcApp.java
@@ -17,6 +17,12 @@ public class UpcApp extends Application implements | @@ -17,6 +17,12 @@ public class UpcApp extends Application implements | ||
17 | private String desc; | 17 | private String desc; |
18 | private final static String localPath = Environment.getExternalStorageDirectory().getPath() + "/UPC NEWS/"; | 18 | private final static String localPath = Environment.getExternalStorageDirectory().getPath() + "/UPC NEWS/"; |
19 | private HLS h; | 19 | private HLS h; |
20 | + private int quality; | ||
21 | + | ||
22 | + public int getQuality(){ | ||
23 | + quality = (int) prefs.getLong("selector", 0); | ||
24 | + return quality; | ||
25 | + } | ||
20 | 26 | ||
21 | public String getLocalPath() { | 27 | public String getLocalPath() { |
22 | return localPath; | 28 | return localPath; |
src/com/upc/pbe/upcnews/VideoActivity.java
@@ -81,6 +81,7 @@ public class VideoActivity extends Activity { | @@ -81,6 +81,7 @@ public class VideoActivity extends Activity { | ||
81 | video.setVideoQuality(MediaPlayer.VIDEOQUALITY_HIGH); | 81 | video.setVideoQuality(MediaPlayer.VIDEOQUALITY_HIGH); |
82 | //Creem un gestor HLS, carreguem el video i iniciem la reproduccio | 82 | //Creem un gestor HLS, carreguem el video i iniciem la reproduccio |
83 | h = ((UpcApp)getApplication()).getHLS(); | 83 | h = ((UpcApp)getApplication()).getHLS(); |
84 | + h.setQuality(((UpcApp)getApplication()).getQuality()); | ||
84 | h.loadVideo(); | 85 | h.loadVideo(); |
85 | video.setMediaController(mc); | 86 | video.setMediaController(mc); |
86 | bm = new BandwidthMeasurer(); | 87 | bm = new BandwidthMeasurer(); |