Commit f81d71c775aaee719fb2c1a37928bf854d81b7ca
1 parent
6cb2d127
--no commit message
Showing
4 changed files
with
14 additions
and
2 deletions
res/xml/prefs.xml
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > |
3 | 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 | 5 | </PreferenceScreen> |
6 | 6 | \ No newline at end of file | ... | ... |
src/com/upc/pbe/upcnews/HLS.java
... | ... | @@ -29,11 +29,16 @@ public class HLS |
29 | 29 | Log.d(TAG, "Esborrat " + files[i].toString()); |
30 | 30 | deleteme.delete(); |
31 | 31 | } |
32 | - currentVideo = currentQuality = currentSegment = 0; | |
32 | + | |
33 | + currentVideo = currentSegment = 0; | |
33 | 34 | this.videos = parsed; |
34 | 35 | endReached = false; |
35 | 36 | } |
36 | 37 | |
38 | + public void setQuality(int qual){ | |
39 | + currentQuality = qual; | |
40 | + } | |
41 | + | |
37 | 42 | public void loadVideo() |
38 | 43 | { |
39 | 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 | 17 | private String desc; |
18 | 18 | private final static String localPath = Environment.getExternalStorageDirectory().getPath() + "/UPC NEWS/"; |
19 | 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 | 27 | public String getLocalPath() { |
22 | 28 | return localPath; | ... | ... |
src/com/upc/pbe/upcnews/VideoActivity.java
... | ... | @@ -81,6 +81,7 @@ public class VideoActivity extends Activity { |
81 | 81 | video.setVideoQuality(MediaPlayer.VIDEOQUALITY_HIGH); |
82 | 82 | //Creem un gestor HLS, carreguem el video i iniciem la reproduccio |
83 | 83 | h = ((UpcApp)getApplication()).getHLS(); |
84 | + h.setQuality(((UpcApp)getApplication()).getQuality()); | |
84 | 85 | h.loadVideo(); |
85 | 86 | video.setMediaController(mc); |
86 | 87 | bm = new BandwidthMeasurer(); | ... | ... |