Permalink
Browse files

External Player Support

  • Loading branch information...
1 parent 64b1973 commit 0580f1df3d5e3f54f84702b00138a76b8d1a7e5c @etmtvdp committed Aug 31, 2011
Showing with 43 additions and 3 deletions.
  1. +6 −0 res/values/strings.xml
  2. +15 −0 res/xml/preferences.xml
  3. +22 −3 src/org/me/tvhguide/ChannelListActivity.java
View
@@ -18,6 +18,12 @@
<string name="pref_port">Port</string>
<string name="pref_port_sum">Enter Server Port</string>
+ <string name="pref_extplayer">External Player</string>
+ <string name="pref_extplayer_sum">Use external player?</string>
+
+ <string name="pref_stream_port">Streaming Port</string>
+ <string name="pref_stream_port_sum">Enter Server Streaming Port</string>
+
<string name="pref_user">Username</string>
<string name="pref_user_sum">Enter Username</string>
View
@@ -17,6 +17,21 @@
android:title="@string/pref_port"
android:key="serverPortPref" />
+ <CheckBoxPreference
+ android:name="@string/pref_extplayer"
+ android:summary="@string/pref_extplayer_sum"
+ android:defaultValue="false"
+ android:title="@string/pref_extplayer"
+ android:key="extPlayer" />
+
+ <EditTextPreference
+ android:name="@string/pref_stream_port"
+ android:summary="@string/pref_stream_port_sum"
+ android:defaultValue="9981"
+ android:inputType="number"
+ android:title="@string/pref_stream_port"
+ android:key="serverStreamPortPref" />
+
<EditTextPreference
android:name="@string/pref_user"
android:summary="@string/pref_user_sum"
@@ -31,6 +31,7 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.drawable.ClipDrawable;
+import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.format.DateFormat;
@@ -124,10 +125,28 @@ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuIn
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
Channel ch = chAdapter.getItem(info.position);
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ boolean useExtPlayer = prefs.getBoolean("extPlayer", false);
+
menu.setHeaderTitle(ch.name);
- Intent intent = new Intent(this, PlaybackActivity.class);
- intent.putExtra("channelId", ch.id);
- item.setIntent(intent);
+
+ if (useExtPlayer) {
+ StringBuilder url = new StringBuilder("http://");
+ url.append(prefs.getString("serverHostPref", "localhost"));
+ url.append(":");
+ url.append(prefs.getString("serverStreamPortPref", "9981"));
+ url.append("/stream/channelid/");
+ url.append(ch.id);
+
+ Intent player = new Intent(Intent.ACTION_VIEW);
+ Uri theUri = Uri.parse(url.toString());
+ player.setDataAndType(theUri, "video/*");
+ item.setIntent(player);
+ } else {
+ Intent intent = new Intent(this, PlaybackActivity.class);
+ intent.putExtra("channelId", ch.id);
+ item.setIntent(intent);
+ }
}
private void showSearch() {

1 comment on commit 0580f1d

Owner

etmtvdp commented on 0580f1d Aug 31, 2011

Hey,

First off, congratulations on the excellent work you have been done on the HTSP client... It's a project that was my on my "what to do if I ever get time" list... That being said, after having just gotten my ASUS tablet I couldn't help tweaking your code a little bit to make it usable (right now) on my tablet (and I am now able to show live TV on the tablet, it's so cool!!!!)

I've made some minimal changes that allow an end-user to choose between the embedded player (which I can see you are working on hard) and an external player. I've had excellent success with both VPlayer and Dracoon video players (both available in the market).... On my tablet, they're easily fast enough to decode the streams and display them...

This change makes it usable for me (and it's only a few lines of code), so I hope you'll be pulling it in...

I also have some idea's about the UI, but I'll contact you by email about that, and see if it is possible / you are willing to do some co-operation on that....

Regards,

//Ton

Please sign in to comment.