This repository has been archived by the owner on Apr 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Android] Support third part media player on Crosswalk
A requirement from an important customer who want to forward web resources with proxy on Crosswalk, but android system MediaPlayer can't set a proxy with a standard API. The ExoMediaPlayer is playing videos and music is a popular activity on Android devices, and it can be configured with proxy. https://developer.android.com/guide/topics/media/exoplayer.html BUG=XWALK-6770
- Loading branch information
Showing
6 changed files
with
189 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 142 additions & 0 deletions
142
runtime/android/core_internal/src/org/xwalk/core/internal/XWalkExMediaPlayerInternal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
// Copyright (c) 2013-2014 Intel Corporation. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package org.xwalk.core.internal; | ||
|
||
import android.content.Context; | ||
import android.net.Uri; | ||
import android.media.MediaPlayer.OnBufferingUpdateListener; | ||
import android.media.MediaPlayer.OnCompletionListener; | ||
import android.media.MediaPlayer.OnErrorListener; | ||
import android.media.MediaPlayer.OnPreparedListener; | ||
import android.media.MediaPlayer.OnSeekCompleteListener; | ||
import android.media.MediaPlayer.OnVideoSizeChangedListener; | ||
import android.util.Log; | ||
import android.view.Surface; | ||
|
||
import java.io.FileDescriptor; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.chromium.media.ExMediaPlayer; | ||
|
||
@XWalkAPI(createExternally = true) | ||
public class XWalkExMediaPlayerInternal extends ExMediaPlayer { | ||
private final static String TAG = "XWalkExMediaPlayerInternal"; | ||
|
||
private void unsupported() { | ||
Log.e(TAG, "ERROR: The function must be implemented"); | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@XWalkAPI | ||
public void setSurface(Surface surface) { | ||
unsupported(); | ||
} | ||
|
||
@XWalkAPI | ||
public void setDataSource(Context context, Uri uri, Map<String, String> headers) { | ||
unsupported(); | ||
} | ||
|
||
@XWalkAPI | ||
public void setDataSource(FileDescriptor fd, long offset, long length) { | ||
unsupported(); | ||
} | ||
|
||
@XWalkAPI | ||
public void setDataSource(Context context, Uri uri) { | ||
unsupported(); | ||
} | ||
|
||
@XWalkAPI | ||
public void prepareAsync() { | ||
unsupported(); | ||
} | ||
|
||
@XWalkAPI | ||
public boolean isPlaying() { | ||
unsupported(); | ||
return false; | ||
} | ||
|
||
@XWalkAPI | ||
public int getVideoWidth() { | ||
unsupported(); | ||
return 0; | ||
} | ||
|
||
@XWalkAPI | ||
public int getVideoHeight() { | ||
unsupported(); | ||
return 0; | ||
} | ||
|
||
@XWalkAPI | ||
public int getCurrentPosition() { | ||
unsupported(); | ||
return 0; | ||
} | ||
|
||
@XWalkAPI | ||
public int getDuration() { | ||
unsupported(); | ||
return 0; | ||
} | ||
|
||
@XWalkAPI | ||
public void release() { | ||
unsupported(); | ||
} | ||
|
||
@XWalkAPI | ||
public void setVolume(float volume1, float volume2) { | ||
unsupported(); | ||
} | ||
|
||
@XWalkAPI | ||
public void start() { | ||
unsupported(); | ||
} | ||
|
||
@XWalkAPI | ||
public void pause() { | ||
unsupported(); | ||
} | ||
|
||
@XWalkAPI | ||
public void seekTo(int msec) { | ||
unsupported(); | ||
} | ||
|
||
@XWalkAPI | ||
public void setOnBufferingUpdateListener(OnBufferingUpdateListener listener) { | ||
unsupported(); | ||
} | ||
|
||
@XWalkAPI | ||
public void setOnCompletionListener(OnCompletionListener listener) { | ||
unsupported(); | ||
} | ||
|
||
@XWalkAPI | ||
public void setOnErrorListener(OnErrorListener listener) { | ||
unsupported(); | ||
} | ||
|
||
@XWalkAPI | ||
public void setOnPreparedListener(OnPreparedListener listener) { | ||
unsupported(); | ||
} | ||
|
||
@XWalkAPI | ||
public void setOnSeekCompleteListener(OnSeekCompleteListener listener) { | ||
unsupported(); | ||
} | ||
|
||
@XWalkAPI | ||
public void setOnVideoSizeChangedListener(OnVideoSizeChangedListener listener) { | ||
unsupported(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters