Bug 1373377 - Remove the 'url must contain .m3u8' constrain. r=kikuo

MozReview-Commit-ID: GN7YefuNY9w

--HG--
extra : rebase_source : 8793e438429ca8521ee3542569797ac1687bace1
This commit is contained in:
James Cheng 2017-06-16 15:47:36 +08:00
parent efd723cdad
commit 4de4243edc

View File

@ -254,20 +254,6 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
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() {
@ -541,7 +527,11 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
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;