OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.app.AlertDialog; | 8 import android.app.AlertDialog; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.content.DialogInterface; | 10 import android.content.DialogInterface; |
(...skipping 15 matching lines...) Expand all Loading... |
26 import android.widget.LinearLayout; | 26 import android.widget.LinearLayout; |
27 import android.widget.MediaController; | 27 import android.widget.MediaController; |
28 import android.widget.MediaController.MediaPlayerControl; | 28 import android.widget.MediaController.MediaPlayerControl; |
29 import android.widget.ProgressBar; | 29 import android.widget.ProgressBar; |
30 import android.widget.TextView; | 30 import android.widget.TextView; |
31 | 31 |
32 import java.lang.ref.WeakReference; | 32 import java.lang.ref.WeakReference; |
33 | 33 |
34 import org.chromium.base.CalledByNative; | 34 import org.chromium.base.CalledByNative; |
35 import org.chromium.base.JNINamespace; | 35 import org.chromium.base.JNINamespace; |
36 import org.chromium.content.app.AppResource; | |
37 import org.chromium.content.common.ISandboxedProcessService; | 36 import org.chromium.content.common.ISandboxedProcessService; |
| 37 import org.chromium.content.R; |
38 | 38 |
39 @JNINamespace("content") | 39 @JNINamespace("content") |
40 public class ContentVideoView extends FrameLayout implements MediaPlayerControl, | 40 public class ContentVideoView extends FrameLayout implements MediaPlayerControl, |
41 SurfaceHolder.Callback, View.OnTouchListener, View.OnKeyListener { | 41 SurfaceHolder.Callback, View.OnTouchListener, View.OnKeyListener { |
42 | 42 |
43 private static final String TAG = "ContentVideoView"; | 43 private static final String TAG = "ContentVideoView"; |
44 | 44 |
45 /* Do not change these values without updating their counterparts | 45 /* Do not change these values without updating their counterparts |
46 * in include/media/mediaplayer.h! | 46 * in include/media/mediaplayer.h! |
47 */ | 47 */ |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 mCurrentBufferPercentage = 0; | 195 mCurrentBufferPercentage = 0; |
196 mVideoSurfaceView = new VideoSurfaceView(context); | 196 mVideoSurfaceView = new VideoSurfaceView(context); |
197 mProgressView = new ProgressView(context); | 197 mProgressView = new ProgressView(context); |
198 } | 198 } |
199 | 199 |
200 private static void initResources(Context context) { | 200 private static void initResources(Context context) { |
201 if (mPlaybackErrorText != null) return; | 201 if (mPlaybackErrorText != null) return; |
202 | 202 |
203 mPlaybackErrorText = context.getString( | 203 mPlaybackErrorText = context.getString( |
204 AppResource.STRING_MEDIA_PLAYER_MESSAGE_PLAYBACK_ERROR); | 204 R.string.media_player_error_text_invalid_progressive_playback); |
205 mUnknownErrorText = context.getString( | 205 mUnknownErrorText = context.getString( |
206 AppResource.STRING_MEDIA_PLAYER_MESSAGE_UNKNOWN_ERROR); | 206 R.string.media_player_error_text_unknown); |
207 mErrorButton = context.getString(AppResource.STRING_MEDIA_PLAYER_ERROR_B
UTTON); | 207 mErrorButton = context.getString(R.string.media_player_error_button); |
208 mErrorTitle = context.getString(AppResource.STRING_MEDIA_PLAYER_ERROR_TI
TLE); | 208 mErrorTitle = context.getString(R.string.media_player_error_title); |
209 mVideoLoadingText = context.getString(AppResource.STRING_MEDIA_PLAYER_LO
ADING_VIDEO); | 209 mVideoLoadingText = context.getString(R.string.media_player_loading_vide
o); |
210 } | 210 } |
211 | 211 |
212 void showContentVideoView() { | 212 void showContentVideoView() { |
213 FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams( | 213 FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams( |
214 ViewGroup.LayoutParams.WRAP_CONTENT, | 214 ViewGroup.LayoutParams.WRAP_CONTENT, |
215 ViewGroup.LayoutParams.WRAP_CONTENT, | 215 ViewGroup.LayoutParams.WRAP_CONTENT, |
216 Gravity.CENTER); | 216 Gravity.CENTER); |
217 this.addView(mVideoSurfaceView, layoutParams); | 217 this.addView(mVideoSurfaceView, layoutParams); |
218 this.addView(mProgressView, layoutParams); | 218 this.addView(mProgressView, layoutParams); |
219 mVideoSurfaceView.setZOrderMediaOverlay(true); | 219 mVideoSurfaceView.setZOrderMediaOverlay(true); |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 private native int nativeGetDurationInMilliSeconds(int nativeContentVideoVie
w); | 623 private native int nativeGetDurationInMilliSeconds(int nativeContentVideoVie
w); |
624 private native void nativeUpdateMediaMetadata(int nativeContentVideoView); | 624 private native void nativeUpdateMediaMetadata(int nativeContentVideoView); |
625 private native int nativeGetVideoWidth(int nativeContentVideoView); | 625 private native int nativeGetVideoWidth(int nativeContentVideoView); |
626 private native int nativeGetVideoHeight(int nativeContentVideoView); | 626 private native int nativeGetVideoHeight(int nativeContentVideoView); |
627 private native boolean nativeIsPlaying(int nativeContentVideoView); | 627 private native boolean nativeIsPlaying(int nativeContentVideoView); |
628 private native void nativePause(int nativeContentVideoView); | 628 private native void nativePause(int nativeContentVideoView); |
629 private native void nativePlay(int nativeContentVideoView); | 629 private native void nativePlay(int nativeContentVideoView); |
630 private native void nativeSeekTo(int nativeContentVideoView, int msec); | 630 private native void nativeSeekTo(int nativeContentVideoView, int msec); |
631 private native void nativeSetSurface(int nativeContentVideoView, Surface sur
face); | 631 private native void nativeSetSurface(int nativeContentVideoView, Surface sur
face); |
632 } | 632 } |
OLD | NEW |