Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64855da7 authored by Teng-Hui Zhu's avatar Teng-Hui Zhu
Browse files

Fix the Uri parsing issue

Switching back to use the setDataSource with Uri, which can handle both the
file and http path correctly.

Change-Id: I5bfc1d01a8de0a4f8640ffceafbc17984833097a
parent f3cdea93
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -3,6 +3,7 @@ package android.webkit;


import android.graphics.SurfaceTexture;
import android.graphics.SurfaceTexture;
import android.media.MediaPlayer;
import android.media.MediaPlayer;
import android.net.Uri;
import android.util.Log;
import android.util.Log;
import android.view.SurfaceView;
import android.view.SurfaceView;
import android.webkit.HTML5VideoViewProxy;
import android.webkit.HTML5VideoViewProxy;
@@ -55,7 +56,7 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener {
    protected boolean mAutostart;
    protected boolean mAutostart;


    // We need to save such info.
    // We need to save such info.
    protected String mUri;
    protected Uri mUri;
    protected Map<String, String> mHeaders;
    protected Map<String, String> mHeaders;


    // The timer for timeupate events.
    // The timer for timeupate events.
@@ -172,7 +173,7 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener {


    public void setVideoURI(String uri, HTML5VideoViewProxy proxy) {
    public void setVideoURI(String uri, HTML5VideoViewProxy proxy) {
        // When switching players, surface texture will be reused.
        // When switching players, surface texture will be reused.
        mUri = uri;
        mUri = Uri.parse(uri);
        mHeaders = generateHeaders(uri, proxy);
        mHeaders = generateHeaders(uri, proxy);
    }
    }


@@ -207,7 +208,7 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener {
        // When there is exception, we could just bail out silently.
        // When there is exception, we could just bail out silently.
        // No Video will be played though. Write the stack for debug
        // No Video will be played though. Write the stack for debug
        try {
        try {
            mPlayer.setDataSource(mUri, mHeaders);
            mPlayer.setDataSource(mProxy.getContext(), mUri, mHeaders);
            mPlayer.prepareAsync();
            mPlayer.prepareAsync();
        } catch (IllegalArgumentException e) {
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
            e.printStackTrace();