Index: src/plugins/youtube/youtube.py
===================================================================
--- src/plugins/youtube/youtube.py	(revision 5426)
+++ src/plugins/youtube/youtube.py	(working copy)
@@ -28,6 +28,7 @@
 		totem.Plugin.__init__(self)
 		self.debug = False
 		self.gstreamer_plugins_present = True
+		self.video_format = -1
 
 		self.max_results = 20
 		self.button_down = False
@@ -50,6 +51,11 @@
 		"""Check for the availability of the flvdemux and souphttpsrc GStreamer plugins"""
 		bvw_name = totem_object.get_video_widget_backend_name ()
 
+		"""If the user's selected 1.5MBps or greater as their connection speed, grab higher-quality videos
+		   and drop the requirement for the flvdemux plugin."""
+		if totem_object.get_connection_speed () >= 10:
+			self.video_format = 18
+
 		if bvw_name.find ("GStreamer") != -1:
 			try:
 				import pygst
@@ -57,13 +63,13 @@
 				import gst
 
 				registry = gst.registry_get_default ()
-				if registry.find_plugin ("flvdemux") == None or registry.find_plugin ("soup") == None:
+				if (self.video_format == -1 and registry.find_plugin ("flvdemux") == None) or registry.find_plugin ("soup") == None:
 					"""This means an error will be displayed when they try to play anything"""
 					self.gstreamer_plugins_present = False
 			except ImportError:
 				"""Do nothing; either it's using xine or python-gstreamer isn't installed"""
 
-		"""Continue loading the plugin as before"""		
+		"""Continue loading the plugin as before"""
 		self.builder = self.load_interface ("youtube.ui", True, totem_object.get_main_window (), self)
 		self.totem = totem_object
 
@@ -141,6 +147,11 @@
 		self.results["related"] = 0
 		self.progress_bar.set_text (_("Fetching related videos..."))
 		self.get_results ("/feeds/api/videos/" + urllib.quote (youtube_id) + "/related?max-results=" + str (self.max_results), "related")
+	def get_fmt_string (self):
+		if self.video_format != -1:
+			return "&fmt=" + str (self.video_format)
+		else:
+			return ""
 	def check_url_for_redirects (self, url_path):
 		try:
 			conn = httplib.HTTPConnection ("www.youtube.com")
@@ -173,7 +184,7 @@
 		location = self.check_url_for_redirects ("/v/" + urllib.quote (youtube_id))
 
 		if location != False:
-			mrl = "http://www.youtube.com/get_video?video_id=" + urllib.quote (youtube_id) + "&t=" + urllib.quote (re.match (".*[?&]t=([^&]+)", location).groups ()[0])
+			mrl = "http://www.youtube.com/get_video?video_id=" + urllib.quote (youtube_id) + "&t=" + urllib.quote (re.match (".*[?&]t=([^&]+)", location).groups ()[0]) + self.get_fmt_string ()
 			"""location_check = self.check_url_for_redirects (mrl)
 			if location_check != False:
 				mrl = location_check
@@ -193,7 +204,7 @@
 		youtube_id = model.get_value (iter, 3)
 
 		"""Open the video in the browser"""
-		os.spawnlp (os.P_NOWAIT, "xdg-open", "xdg-open", "http://www.youtube.com/watch?v=" + urllib.quote (youtube_id))
+		os.spawnlp (os.P_NOWAIT, "xdg-open", "xdg-open", "http://www.youtube.com/watch?v=" + urllib.quote (youtube_id) + self.get_fmt_string ())
 	def on_button_press_event (self, widget, event):
 		self.button_down = True
 	def on_button_release_event (self, widget, event):
Index: src/totem.c
===================================================================
--- src/totem.c	(revision 5426)
+++ src/totem.c	(working copy)
@@ -1664,7 +1664,7 @@
 static void
 on_playlist_change_name (TotemPlaylist *playlist, Totem *totem)
 {
-	char *name, *artist, *album, *title;
+	char *name;
 	gboolean cur;
 
 	if ((name = totem_playlist_get_current_title (playlist,
Index: src/totem-object.c
===================================================================
--- src/totem-object.c	(revision 5426)
+++ src/totem-object.c	(working copy)
@@ -220,6 +220,22 @@
 }
 
 /**
+ * totem_get_connection_speed:
+ * @totem: a #TotemObject
+ *
+ * Get the configured connection speed in as a digital value from
+ * 0 (14.4 Kbps) to 11 (Intranet). The default is 11.
+ *
+ * Return value: the connection speed
+ **/
+guint
+totem_get_connection_speed (Totem *totem)
+{
+	g_return_val_if_fail (TOTEM_IS_OBJECT (totem), 11);
+	return bacon_video_widget_get_connection_speed (totem->bvw);
+} 
+
+/**
  * totem_get_main_window:
  * @totem: a #TotemObject
  *
Index: src/totem.h
===================================================================
--- src/totem.h	(revision 5426)
+++ src/totem.h	(working copy)
@@ -163,6 +163,7 @@
 gboolean totem_is_playing			(Totem *totem);
 gboolean totem_is_paused			(Totem *totem);
 gboolean totem_is_seekable			(Totem *totem);
+guint totem_get_connection_speed		(Totem *totem);
 GtkWindow *totem_get_main_window		(Totem *totem);
 GtkUIManager *totem_get_ui_manager		(Totem *totem);
 GtkWidget *totem_get_video_widget		(Totem *totem);
Index: bindings/python/totem.defs
===================================================================
--- bindings/python/totem.defs	(revision 5426)
+++ bindings/python/totem.defs	(working copy)
@@ -359,6 +359,12 @@
   (return-type "gboolean")
 )
 
+(define-method get_connection_speed
+  (of-object "TotemObject")
+  (c-name "totem_get_connection_speed")
+  (return-type "guint")
+)
+
 (define-method get_main_window
   (of-object "TotemObject")
   (c-name "totem_get_main_window")
