Bug 1373377 - Remove the 'url must contain .m3u8' constrain. r=kikuo
authorJames Cheng <jacheng@mozilla.com>
Fri, 16 Jun 2017 15:47:36 +0800
changeset 364549 d9e4073abd4cb2166768abfa669190ac7a0b8f53
parent 364548 3673b20f7b49b6749773a4882331c260cbf821af
child 364550 4b9cc1cd08ea57cc83ee49d996794846537c4ca7
push id32047
push userarchaeopteryx@coole-files.de
push dateSun, 18 Jun 2017 18:28:16 +0000
treeherdermozilla-central@ae20db43e815 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskikuo
bugs1373377
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1373377 - Remove the 'url must contain .m3u8' constrain. r=kikuo MozReview-Commit-ID: GN7YefuNY9w
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsPlayer.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsPlayer.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsPlayer.java
@@ -249,30 +249,16 @@ public class GeckoHlsPlayer implements B
         return new DefaultDataSourceFactory(ctx, bandwidthMeter,
                 buildHttpDataSourceFactory(bandwidthMeter));
     }
 
     private HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
         return new DefaultHttpDataSourceFactory(AppConstants.USER_AGENT_FENNEC_MOBILE, bandwidthMeter);
     }
 
-    private MediaSource buildMediaSource(Uri uri, String overrideExtension) {
-        if (DEBUG) { Log.d(LOGTAG, "buildMediaSource uri[" + uri + "]" + ", overridedExt[" + overrideExtension + "]"); }
-        int type = Util.inferContentType(TextUtils.isEmpty(overrideExtension)
-                                         ? uri.getLastPathSegment()
-                                         : "." + overrideExtension);
-        switch (type) {
-            case C.TYPE_HLS:
-                return new HlsMediaSource(uri, mMediaDataSourceFactory, mMainHandler, null);
-            default:
-                mResourceCallbacks.onError(ResourceError.UNSUPPORTED.code());
-                throw new IllegalArgumentException("Unsupported type: " + type);
-        }
-    }
-
     // To make sure that each player has a unique id, GeckoHlsPlayer should be
     // created only from synchronized APIs in GeckoPlayerFactory.
     public GeckoHlsPlayer() {
         mPlayerId = sPlayerId.incrementAndGet();
         if (DEBUG) { Log.d(LOGTAG, " construct player with id(" + mPlayerId + ")"); }
     }
 
     // Should be only called by GeckoPlayerFactory and GeckoHLSResourceWrapper.
@@ -536,17 +522,21 @@ public class GeckoHlsPlayer implements B
         mRenderers[1] = mARenderer;
 
         // Create ExoPlayer instance with specific components.
         mPlayer = ExoPlayerFactory.newInstance(mRenderers, mTrackSelector);
         mPlayer.addListener(this);
 
         Uri uri = Uri.parse(url);
         mMediaDataSourceFactory = buildDataSourceFactory(ctx, BANDWIDTH_METER);
-        mMediaSource = buildMediaSource(uri, null);
+        mMediaSource = new HlsMediaSource(uri, mMediaDataSourceFactory, mMainHandler, null);
+        if (DEBUG) {
+            Log.d(LOGTAG, "Uri is " + uri +
+                          ", ContentType is " + Util.inferContentType(uri.getLastPathSegment()));
+        }
 
         mPlayer.prepare(mMediaSource);
         mIsPlayerInitDone = true;
     }
 
     @Override
     public boolean isLiveStream() {
         return !mIsTimelineStatic;