Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

[Android] Support third part media player on Crosswalk #3736

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public XWalkContent(Context context, String animatable, XWalkViewInternal xwView
mGeolocationPermissions = new XWalkGeolocationPermissions(sharedPreferences);

MediaPlayerBridge.setResourceLoadingFilter(
new XWalkMediaPlayerResourceLoadingFilter());
new XWalkMediaPlayerResourceLoadingFilter(mContentsClientBridge));

setNativeContent(nativeInit(), animatable);

Expand Down Expand Up @@ -391,6 +391,11 @@ public void setXWalkWebChromeClient(XWalkWebChromeClient client) {
mContentsClientBridge.setXWalkWebChromeClient(client);
}

public void setXWalkMediaPlayer(XWalkMediaPlayerInternal mediaPlayer) {
if (mNativeContent == 0) return;
mContentsClientBridge.setXWalkMediaPlayer(mediaPlayer);
}

public XWalkWebChromeClient getXWalkWebChromeClient() {
if (mNativeContent == 0) return null;
return mContentsClientBridge.getXWalkWebChromeClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class XWalkContentsClientBridge extends XWalkContentsClient
private XWalkNavigationHandler mNavigationHandler;
private XWalkNotificationService mNotificationService;
private Handler mUiThreadHandler;
private XWalkMediaPlayerInternal mXWalkMediaPlayerInternal;

/** State recording variables */
// For fullscreen state.
Expand Down Expand Up @@ -163,6 +164,13 @@ public void setResourceClient(XWalkResourceClientInternal client) {
mXWalkResourceClient = new XWalkResourceClientInternal(mXWalkView);
}

public void setXWalkMediaPlayer(XWalkMediaPlayerInternal mediaPlayer) {
mXWalkMediaPlayerInternal = mediaPlayer;
}

public XWalkMediaPlayerInternal getExternalMediaPlayer() {
return mXWalkMediaPlayerInternal;
}

public void setXWalkWebChromeClient(XWalkWebChromeClient client) {
// If it's null, use Crosswalk implementation.
Expand Down
Loading