AI2 Component  (Version nb184)
VideoPlayer.java
Go to the documentation of this file.
1 // -*- mode: java; c-basic-offset: 2; -*-
2 // Copyright 2009-2011 Google, All Rights reserved
3 // Copyright 2011-2020 MIT, All rights reserved
4 // Released under the Apache License, Version 2.0
5 // http://www.apache.org/licenses/LICENSE-2.0
6 
7 package com.google.appinventor.components.runtime;
8 
9 import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
10 
11 import android.content.Context;
12 import android.media.AudioManager;
13 import android.media.MediaPlayer;
14 import android.media.MediaPlayer.OnCompletionListener;
15 import android.media.MediaPlayer.OnErrorListener;
16 import android.media.MediaPlayer.OnPreparedListener;
17 import android.os.Bundle;
18 import android.os.Handler;
19 import android.util.Log;
20 import android.view.View;
21 import android.widget.MediaController;
22 import android.widget.VideoView;
40 import java.io.IOException;
41 
95 @DesignerComponent(
96  version = YaVersion.VIDEOPLAYER_COMPONENT_VERSION,
97  description = "A multimedia component capable of playing videos. "
98  + "When the application is run, the VideoPlayer will be displayed as a "
99  + "rectangle on-screen. If the user touches the rectangle, controls will "
100  + "appear to play/pause, skip ahead, and skip backward within the video. "
101  + "The application can also control behavior by calling the "
102  + "<code>Start</code>, <code>Pause</code>, and <code>SeekTo</code> methods. "
103  + "<p>Video files should be in "
104  + "3GPP (.3gp) or MPEG-4 (.mp4) formats. For more details about legal "
105  + "formats, see "
106  + "<a href=\"http://developer.android.com/guide/appendix/media-formats.html\""
107  + " target=\"_blank\">Android Supported Media Formats</a>.</p>"
108  + "<p>App Inventor for Android only permits video files under 1 MB and "
109  + "limits the total size of an application to 5 MB, not all of which is "
110  + "available for media (video, audio, and sound) files. If your media "
111  + "files are too large, you may get errors when packaging or installing "
112  + "your application, in which case you should reduce the number of media "
113  + "files or their sizes. Most video editing software, such as Windows "
114  + "Movie Maker and Apple iMovie, can help you decrease the size of videos "
115  + "by shortening them or re-encoding the video into a more compact format.</p>"
116  + "<p>You can also set the media source to a URL that points to a streaming video, "
117  + "but the URL must point to the video file itself, not to a program that plays the video.",
118  category = ComponentCategory.MEDIA)
119 @SimpleObject
120 @UsesPermissions(permissionNames = "android.permission.INTERNET")
121 public final class VideoPlayer extends AndroidViewComponent implements
122  OnDestroyListener, Deleteable, OnCompletionListener, OnErrorListener,
123  OnPreparedListener {
124 
125  /*
126  * Video clip with player controls (touch it to activate)
127  */
128 
129  private final ResizableVideoView videoView;
130 
131  private String sourcePath; // name of media source
132 
133  private boolean inFullScreen = false;
134 
135  // The VideoView does not always start playing if Start is called
136  // shortly after the source is set. These flags are used to fix this
137  // problem.
138  private boolean mediaReady = false;
139 
140  private boolean delayedStart = false;
141 
142  private MediaPlayer mPlayer;
143 
144  private final Handler androidUIHandler = new Handler();
145 
151  public VideoPlayer(ComponentContainer container) {
152  super(container);
153  container.$form().registerForOnDestroy(this);
154  videoView = new ResizableVideoView(container.$context());
155  videoView.setMediaController(new MediaController(container.$context()));
156  videoView.setOnCompletionListener(this);
157  videoView.setOnErrorListener(this);
158  videoView.setOnPreparedListener(this);
159 
160  // add the component to the designated container
161  container.$add(this);
162  // set a default size
163  container.setChildWidth(this,
165  container.setChildHeight(this,
167 
168  // Make volume buttons control media, not ringer.
169  container.$form().setVolumeControlStream(AudioManager.STREAM_MUSIC);
170 
171  sourcePath = "";
172  }
173 
174  @Override
175  public View getView() {
176  return videoView;
177  }
178 
191  defaultValue = "")
193  description = "The \"path\" to the video. Usually, this will be the "
194  + "name of the video file, which should be added in the Designer.",
195  category = PropertyCategory.BEHAVIOR)
196  @UsesPermissions(READ_EXTERNAL_STORAGE)
197  public void Source(String path) {
198  final String tempPath = (path == null) ? "" : path;
199  if (MediaUtil.isExternalFile(container.$context(), tempPath)
200  && container.$form().isDeniedPermission(READ_EXTERNAL_STORAGE)) {
201  container.$form().askPermission(READ_EXTERNAL_STORAGE, new PermissionResultHandler() {
202  @Override
203  public void HandlePermissionResponse(String permission, boolean granted) {
204  if (granted) {
205  VideoPlayer.this.Source(tempPath);
206  } else {
207  container.$form().dispatchPermissionDeniedEvent(VideoPlayer.this, "Source", permission);
208  }
209  }
210  });
211  return;
212  }
213 
214  if (inFullScreen) {
215  container.$form().fullScreenVideoAction(
217  } else {
218  sourcePath = (path == null) ? "" : path;
219 
220  // The source may change for the MediaPlayer, and
221  // getVideoWidth or getVideoHeight may be called
222  // creating an error in ResizableVideoView.
223  videoView.invalidateMediaPlayer(true);
224 
225  // Clear the previous video.
226  if (videoView.isPlaying()) {
227  videoView.stopPlayback();
228  }
229  videoView.setVideoURI(null);
230  videoView.clearAnimation();
231 
232  if (sourcePath.length() > 0) {
233  Log.i("VideoPlayer", "Source path is " + sourcePath);
234 
235  try {
236  mediaReady = false;
237  MediaUtil.loadVideoView(videoView, container.$form(), sourcePath);
238  } catch (PermissionException e) {
239  container.$form().dispatchPermissionDeniedEvent(this, "Source", e);
240  return;
241  } catch (IOException e) {
242  container.$form().dispatchErrorOccurredEvent(this, "Source",
244  return;
245  }
246 
247  Log.i("VideoPlayer", "loading video succeeded");
248  }
249  }
250  }
251 
259  @SimpleFunction(description = "Starts playback of the video.")
260  public void Start() {
261  Log.i("VideoPlayer", "Calling Start");
262  if (inFullScreen) {
263  container.$form().fullScreenVideoAction(
265  } else {
266  if (mediaReady) {
267  videoView.start();
268  } else {
269  delayedStart = true;
270  }
271  }
272  }
273 
274 
275 
276 
277 
286  defaultValue = "50")
288  description = "Sets the volume to a number between 0 and 100. " +
289  "Values less than 0 will be treated as 0, and values greater than 100 " +
290  "will be treated as 100.")
291  public void Volume(int vol) {
292  // clip volume to range [0, 100]
293  vol = Math.max(vol, 0);
294  vol = Math.min(vol, 100);
295  if (mPlayer != null) {
296  mPlayer.setVolume(((float) vol) / 100, ((float) vol) / 100);
297  }
298  }
299 
300 
305  public void delayedStart() {
306  delayedStart = true;
307  Start();
308  }
309 
315  description = "Pauses playback of the video. Playback can be resumed "
316  + "at the same location by calling the <code>Start</code> method.")
317  public void Pause() {
318  Log.i("VideoPlayer", "Calling Pause");
319  if (inFullScreen) {
320  container.$form().fullScreenVideoAction(
322  delayedStart = false;
323  } else {
324  delayedStart = false;
325  videoView.pause();
326  }
327  }
328 
330  description = "Resets to start of video and pauses it if video was playing.")
331  public void Stop() {
332  Log.i("VideoPlayer", "Calling Stop");
333  // Call start() to ensure frame shown is updated;
334  // Otherwise stopping while a video is on pause will not refresh its view
335  // until video is started again.
336  Start();
337  SeekTo(0);
338  Pause();
339  }
340 
342  description = "Seeks to the requested time (specified in milliseconds) in the video. " +
343  "If the video is paused, the frame shown will not be updated by the seek. " +
344  "The player can jump only to key frames in the video, so seeking to times that " +
345  "differ by short intervals may not actually move to different frames.")
346  public void SeekTo(int ms) {
347  Log.i("VideoPlayer", "Calling SeekTo");
348  if (ms < 0) {
349  ms = 0;
350  }
351  if (inFullScreen) {
352  container.$form().fullScreenVideoAction(
354  } else {
355  // There is no harm if the milliseconds is longer than the duration.
356  videoView.seekTo(ms);
357  }
358  }
359 
361  description = "Returns duration of the video in milliseconds.")
362  public int GetDuration() {
363  Log.i("VideoPlayer", "Calling GetDuration");
364  if (inFullScreen) {
365  Bundle result = container.$form().fullScreenVideoAction(
367  if (result.getBoolean(FullScreenVideoUtil.ACTION_SUCESS)) {
368  return result.getInt(FullScreenVideoUtil.ACTION_DATA);
369  } else {
370  return 0;
371  }
372  } else {
373  return videoView.getDuration();
374  }
375  }
376 
377  // OnCompletionListener implementation
378 
379  @Override
380  public void onCompletion(MediaPlayer m) {
381  Completed();
382  }
383 
387  @SimpleEvent
388  public void Completed() {
389  EventDispatcher.dispatchEvent(this, "Completed");
390  }
391 
392  // OnErrorListener implementation
393 
394  @Override
395  public boolean onError(MediaPlayer m, int what, int extra) {
396 
397  // The ResizableVideoView onMeasure method attempts to use the MediaPlayer
398  // to measure
399  // the VideoPlayer; but in the event of an error, the MediaPlayer
400  // may report dimensions of zero video width and height.
401  // Since VideoPlayer currently (7/10/2012) sets its size always
402  // to some non-zero number, the MediaPlayer is invalidated here
403  // to prevent onMeasure from setting width and height as zero.
404  videoView.invalidateMediaPlayer(true);
405 
406  delayedStart = false;
407  mediaReady = false;
408 
409  Log.e("VideoPlayer",
410  "onError: what is " + what + " 0x" + Integer.toHexString(what)
411  + ", extra is " + extra + " 0x" + Integer.toHexString(extra));
412  container.$form().dispatchErrorOccurredEvent(this, "Source",
414  return true;
415  }
416 
417  @Override
418  public void onPrepared(MediaPlayer newMediaPlayer) {
419  mediaReady = true;
420  delayedStart = false;
421  mPlayer = newMediaPlayer;
422  videoView.setMediaPlayer(mPlayer, true);
423  if (delayedStart) {
424  Start();
425  }
426  }
427 
428  @SimpleEvent(description = "The VideoPlayerError event is no longer used. "
429  + "Please use the Screen.ErrorOccurred event instead.",
430  userVisible = false)
431  public void VideoPlayerError(String message) {
432  }
433 
434  // OnDestroyListener implementation
435 
436  @Override
437  public void onDestroy() {
438  prepareToDie();
439  }
440 
441  // Deleteable implementation
442 
443  @Override
444  public void onDelete() {
445  prepareToDie();
446  }
447 
448  private void prepareToDie() {
449  if (videoView.isPlaying()) {
450  videoView.stopPlayback();
451  }
452  videoView.setVideoURI(null);
453  videoView.clearAnimation();
454 
455  delayedStart = false;
456  mediaReady = false;
457 
458  if (inFullScreen) {
459  Bundle data = new Bundle();
460  data.putBoolean(FullScreenVideoUtil.VIDEOPLAYER_FULLSCREEN, false);
461  container.$form().fullScreenVideoAction(
462  FullScreenVideoUtil.FULLSCREEN_VIDEO_ACTION_FULLSCREEN, this, data);
463  }
464  }
465 
472  @Override
473  @SimpleProperty
474  public int Width() {
475  return super.Width();
476  }
477 
484  @Override
485  @SimpleProperty(userVisible = true)
486  public void Width(int width) {
487  super.Width(width);
488 
489  // Forces a layout of the ResizableVideoView
490  videoView.changeVideoSize(width, videoView.forcedHeight);
491  }
492 
499  @Override
501  public int Height() {
502  return super.Height();
503  }
504 
511  @Override
512  @SimpleProperty(userVisible = true)
513  public void Height(int height) {
514  super.Height(height);
515 
516  // Forces a layout of the ResizableVideoView
517  videoView.changeVideoSize(videoView.forcedWidth, height);
518  }
519 
526  public boolean FullScreen() {
527  return inFullScreen;
528  }
529 
538  @SimpleProperty(userVisible = true)
539  public void FullScreen(boolean value) {
540 
541  if (value && (SdkLevel.getLevel() <= SdkLevel.LEVEL_DONUT)) {
542  container.$form().dispatchErrorOccurredEvent(this, "FullScreen(true)",
544  return;
545  }
546 
547  if (value != inFullScreen) {
548  if (value) {
549  Bundle data = new Bundle();
551  videoView.getCurrentPosition());
553  videoView.isPlaying());
554  videoView.pause();
555  data.putBoolean(FullScreenVideoUtil.VIDEOPLAYER_FULLSCREEN, true);
556  data.putString(FullScreenVideoUtil.VIDEOPLAYER_SOURCE, sourcePath);
557  Bundle result = container.$form().fullScreenVideoAction(
559  if (result.getBoolean(FullScreenVideoUtil.ACTION_SUCESS)) {
560  inFullScreen = true;
561  } else {
562  inFullScreen = false;
563  container.$form().dispatchErrorOccurredEvent(this, "FullScreen",
565  }
566  } else {
567  Bundle values = new Bundle();
568  values.putBoolean(FullScreenVideoUtil.VIDEOPLAYER_FULLSCREEN, false);
569  Bundle result = container.$form().fullScreenVideoAction(
571  values);
572  if (result.getBoolean(FullScreenVideoUtil.ACTION_SUCESS)) {
573  fullScreenKilled((Bundle) result);
574  } else {
575  inFullScreen = true;
576  container.$form().dispatchErrorOccurredEvent(this, "FullScreen",
578  }
579  }
580  }
581  }
582 
589  public void fullScreenKilled(Bundle data) {
590  inFullScreen = false;
591  String newSource = data.getString(FullScreenVideoUtil.VIDEOPLAYER_SOURCE);
592  if (!newSource.equals(sourcePath)) {
593  Source(newSource);
594  }
595  videoView.setVisibility(View.VISIBLE);
596  videoView.requestLayout();
597  SeekTo(data.getInt(FullScreenVideoUtil.VIDEOPLAYER_POSITION));
598  if (data.getBoolean(FullScreenVideoUtil.VIDEOPLAYER_PLAYING)) {
599  Start();
600  }
601  }
602 
607  public int getPassedWidth() {
608  return videoView.forcedWidth;
609  }
610 
615  public int getPassedHeight() {
616  return videoView.forcedHeight;
617  }
618 
625  class ResizableVideoView extends VideoView {
626 
627  private MediaPlayer mVideoPlayer;
628 
629  /*
630  * Used by onMeasure to determine whether the mVideoPlayer should be used to
631  * measure the view.
632  */
633  private Boolean mFoundMediaPlayer = false;
634 
639  public int forcedWidth = LENGTH_PREFERRED;
640 
645  public int forcedHeight = LENGTH_PREFERRED;
646 
647  public ResizableVideoView(Context context) {
648  super(context);
649  }
650 
651  public void onMeasure(int specwidth, int specheight) {
652  onMeasure(specwidth, specheight, 0);
653  }
654 
655  private void onMeasure(final int specwidth, final int specheight, final int trycount) {
656  // Since super.onMeasure uses the aspect ratio of the video being
657  // played, it is not called.
658  // http://grepcode.com/file/repository.grepcode.com/java/ext/
659  // com.google.android/android/2.2.2_r1/android/widget/VideoView.java
660  // #VideoView.onMeasure%28int%2Cint%29
661 
662  // Log messages in this method are not commented out for testing the
663  // changes
664  // on other devices.
665  boolean scaleHeight = false;
666  boolean scaleWidth = false;
667  float deviceDensity = container.$form().deviceDensity();
668  Log.i("VideoPlayer..onMeasure", "Device Density = " + deviceDensity);
669  Log.i("VideoPlayer..onMeasure", "AI setting dimensions as:" + forcedWidth
670  + ":" + forcedHeight);
671  Log.i("VideoPlayer..onMeasure",
672  "Dimenions from super>>" + MeasureSpec.getSize(specwidth) + ":"
673  + MeasureSpec.getSize(specheight));
674 
675  // The VideoPlayer's dimensions must always be some non-zero number.
676  int width = ComponentConstants.VIDEOPLAYER_PREFERRED_WIDTH;
677  int height = ComponentConstants.VIDEOPLAYER_PREFERRED_HEIGHT;
678 
679  switch (forcedWidth) {
680  case LENGTH_FILL_PARENT:
681  switch (MeasureSpec.getMode(specwidth)) {
682  case MeasureSpec.EXACTLY:
683  case MeasureSpec.AT_MOST:
684  width = MeasureSpec.getSize(specwidth);
685  break;
686  case MeasureSpec.UNSPECIFIED:
687  try {
688  width = ((View) getParent()).getMeasuredWidth();
689  } catch (ClassCastException cast) {
690  width = ComponentConstants.VIDEOPLAYER_PREFERRED_WIDTH;
691  } catch (NullPointerException nullParent) {
692  width = ComponentConstants.VIDEOPLAYER_PREFERRED_WIDTH;
693  }
694  }
695  break;
696  case LENGTH_PREFERRED:
697  if (mFoundMediaPlayer) {
698  try {
699  width = mVideoPlayer.getVideoWidth();
700  Log.i("VideoPlayer.onMeasure", "Got width from MediaPlayer>"
701  + width);
702  } catch (NullPointerException nullVideoPlayer) {
703  Log.e(
704  "VideoPlayer..onMeasure",
705  "Failed to get MediaPlayer for width:\n"
706  + nullVideoPlayer.getMessage());
707  width = ComponentConstants.VIDEOPLAYER_PREFERRED_WIDTH;
708  }
709  } else {
710  }
711  break;
712  default:
713  scaleWidth = true;
714  width = forcedWidth;
715  }
716 
717  if (forcedWidth <= LENGTH_PERCENT_TAG) {
718  int cWidth = container.$form().Width();
719  if (cWidth == 0 && trycount < 2) {
720  Log.d("VideoPlayer...onMeasure", "Width not stable... trying again (onMeasure " + trycount + ")");
721  androidUIHandler.postDelayed(new Runnable() {
722  @Override
723  public void run() {
724  onMeasure(specwidth, specheight, trycount + 1);
725  }
726  }, 100); // Try again in 1/10 of a second
727  setMeasuredDimension(100, 100); // We have to set something or our caller is unhappy
728  return;
729  }
730  width = (int) ((float) (cWidth * (- (width - LENGTH_PERCENT_TAG)) / 100) * deviceDensity);
731  } else if (scaleWidth) {
732  width = (int) ((float) width * deviceDensity);
733  }
734 
735  switch (forcedHeight) {
736  case LENGTH_FILL_PARENT:
737  switch (MeasureSpec.getMode(specheight)) {
738  case MeasureSpec.EXACTLY:
739  case MeasureSpec.AT_MOST:
740  height = MeasureSpec.getSize(specheight);
741  break;
742  case MeasureSpec.UNSPECIFIED:
743  // Use height from ComponentConstants
744  // The current measuring of components ignores FILL_PARENT for height,
745  // and does not actually fill the height of the parent container.
746  }
747  break;
748  case LENGTH_PREFERRED:
749  if (mFoundMediaPlayer) {
750  try {
751  height = mVideoPlayer.getVideoHeight();
752  Log.i("VideoPlayer.onMeasure", "Got height from MediaPlayer>"
753  + height);
754  } catch (NullPointerException nullVideoPlayer) {
755  Log.e(
756  "VideoPlayer..onMeasure",
757  "Failed to get MediaPlayer for height:\n"
758  + nullVideoPlayer.getMessage());
759  height = ComponentConstants.VIDEOPLAYER_PREFERRED_HEIGHT;
760  }
761  }
762  break;
763  default:
764  scaleHeight = true;
765  height = forcedHeight;
766  }
767 
768  if (forcedHeight <= LENGTH_PERCENT_TAG) {
769  int cHeight = container.$form().Height();
770  if (cHeight == 0 && trycount < 2) {
771  Log.d("VideoPlayer...onMeasure", "Height not stable... trying again (onMeasure " + trycount + ")");
772  androidUIHandler.postDelayed(new Runnable() {
773  @Override
774  public void run() {
775  onMeasure(specwidth, specheight, trycount + 1);
776  }
777  }, 100); // Try again in 1/10 of a second
778  setMeasuredDimension(100, 100); // We have to set something or our caller is unhappy
779  return;
780  }
781  height = (int) ((float) (cHeight * (- (height - LENGTH_PERCENT_TAG)) / 100) * deviceDensity);
782  } else if (scaleHeight) {
783  height = (int) ((float) height * deviceDensity);
784  }
785 
786  // Forces the video playing in the VideoView to scale.
787  // Some Android devices though will not scale the video playing.
788  Log.i("VideoPlayer.onMeasure", "Setting dimensions to:" + width + "x"
789  + height);
790  getHolder().setFixedSize(width, height);
791 
792  setMeasuredDimension(width, height);
793  }
794 
798  public void changeVideoSize(int newWidth, int newHeight) {
799  forcedWidth = newWidth;
800  forcedHeight = newHeight;
801 
802  forceLayout();
803  invalidate();
804  }
805 
806  /*
807  * Used to keep onMeasure from using the mVideoPlayer in measuring.
808  */
809  public void invalidateMediaPlayer(boolean triggerRedraw) {
810  mFoundMediaPlayer = false;
811  mVideoPlayer = null;
812 
813  if (triggerRedraw) {
814  forceLayout();
815  invalidate();
816  }
817  }
818 
819  public void
820  setMediaPlayer(MediaPlayer newMediaPlayer, boolean triggerRedraw) {
821  mVideoPlayer = newMediaPlayer;
822  mFoundMediaPlayer = true;
823 
824  if (triggerRedraw) {
825  forceLayout();
826  invalidate();
827  }
828  }
829  }
830 }
com.google.appinventor.components.runtime.EventDispatcher
Definition: EventDispatcher.java:22
com.google.appinventor.components.runtime.VideoPlayer.delayedStart
void delayedStart()
Definition: VideoPlayer.java:305
com.google.appinventor.components.annotations.SimpleFunction
Definition: SimpleFunction.java:23
com.google.appinventor.components.runtime.util.MediaUtil.isExternalFile
static boolean isExternalFile(String mediaPath)
Definition: MediaUtil.java:218
com.google.appinventor.components.runtime.util.FullScreenVideoUtil.FULLSCREEN_VIDEO_ACTION_SOURCE
static final int FULLSCREEN_VIDEO_ACTION_SOURCE
Definition: FullScreenVideoUtil.java:53
com.google.appinventor.components.common.ComponentConstants.VIDEOPLAYER_PREFERRED_HEIGHT
static final int VIDEOPLAYER_PREFERRED_HEIGHT
Definition: ComponentConstants.java:45
com.google.appinventor.components.runtime.VideoPlayer.onDelete
void onDelete()
Definition: VideoPlayer.java:444
com.google.appinventor.components.runtime.Form.registerForOnDestroy
void registerForOnDestroy(OnDestroyListener component)
Definition: Form.java:817
com.google.appinventor.components.runtime.util.ErrorMessages
Definition: ErrorMessages.java:17
com.google.appinventor.components.runtime.util
-*- mode: java; c-basic-offset: 2; -*-
Definition: AccountChooser.java:7
com.google.appinventor.components.runtime.util.ErrorMessages.ERROR_UNABLE_TO_LOAD_MEDIA
static final int ERROR_UNABLE_TO_LOAD_MEDIA
Definition: ErrorMessages.java:93
com.google.appinventor.components.common.YaVersion
Definition: YaVersion.java:14
com.google.appinventor.components.runtime.VideoPlayer.onDestroy
void onDestroy()
Definition: VideoPlayer.java:437
com.google.appinventor.components.annotations.DesignerProperty
Definition: DesignerProperty.java:25
com.google.appinventor.components.runtime.util.FullScreenVideoUtil
Definition: FullScreenVideoUtil.java:39
com.google.appinventor.components.runtime.util.FullScreenVideoUtil.ACTION_DATA
static final String ACTION_DATA
Definition: FullScreenVideoUtil.java:69
com.google.appinventor.components
com.google.appinventor.components.runtime.ComponentContainer.setChildWidth
void setChildWidth(AndroidViewComponent component, int width)
com.google.appinventor.components.runtime.util.FullScreenVideoUtil.VIDEOPLAYER_SOURCE
static final String VIDEOPLAYER_SOURCE
Definition: FullScreenVideoUtil.java:65
com.google.appinventor.components.runtime.util.FullScreenVideoUtil.VIDEOPLAYER_POSITION
static final String VIDEOPLAYER_POSITION
Definition: FullScreenVideoUtil.java:63
com.google.appinventor.components.runtime.util.MediaUtil
Definition: MediaUtil.java:53
com.google.appinventor.components.annotations.DesignerComponent
Definition: DesignerComponent.java:22
com.google.appinventor.components.annotations.SimpleEvent
Definition: SimpleEvent.java:20
com.google.appinventor.components.annotations.PropertyCategory.BEHAVIOR
BEHAVIOR
Definition: PropertyCategory.java:15
com.google.appinventor.components.runtime.VideoPlayer.getView
View getView()
Definition: VideoPlayer.java:175
com.google.appinventor.components.runtime.VideoPlayer.Height
int Height()
Definition: VideoPlayer.java:501
com.google.appinventor.components.runtime.ComponentContainer.setChildHeight
void setChildHeight(AndroidViewComponent component, int height)
com.google.appinventor.components.runtime.ComponentContainer.$add
void $add(AndroidViewComponent component)
com.google.appinventor.components.runtime.util.FullScreenVideoUtil.ACTION_SUCESS
static final String ACTION_SUCESS
Definition: FullScreenVideoUtil.java:67
com.google.appinventor.components.annotations.UsesPermissions
Definition: UsesPermissions.java:21
com.google.appinventor.components.runtime.util.FullScreenVideoUtil.FULLSCREEN_VIDEO_ACTION_DURATION
static final int FULLSCREEN_VIDEO_ACTION_DURATION
Definition: FullScreenVideoUtil.java:57
com.google.appinventor.components.runtime.util.SdkLevel.LEVEL_DONUT
static final int LEVEL_DONUT
Definition: SdkLevel.java:21
com.google.appinventor.components.runtime.VideoPlayer.getPassedHeight
int getPassedHeight()
Definition: VideoPlayer.java:615
com.google.appinventor.components.runtime.VideoPlayer.onError
boolean onError(MediaPlayer m, int what, int extra)
Definition: VideoPlayer.java:395
com.google.appinventor.components.runtime.PermissionResultHandler
Definition: PermissionResultHandler.java:15
com.google.appinventor.components.runtime.VideoPlayer
Definition: VideoPlayer.java:121
com.google.appinventor.components.runtime.EventDispatcher.dispatchEvent
static boolean dispatchEvent(Component component, String eventName, Object...args)
Definition: EventDispatcher.java:188
com.google.appinventor.components.runtime.util.FullScreenVideoUtil.FULLSCREEN_VIDEO_ACTION_PAUSE
static final int FULLSCREEN_VIDEO_ACTION_PAUSE
Definition: FullScreenVideoUtil.java:49
com.google.appinventor.components.runtime.util.SdkLevel
Definition: SdkLevel.java:19
com.google.appinventor.components.runtime.util.ErrorMessages.ERROR_VIDEOPLAYER_FULLSCREEN_CANT_EXIT
static final int ERROR_VIDEOPLAYER_FULLSCREEN_CANT_EXIT
Definition: ErrorMessages.java:151
com.google.appinventor.components.annotations.SimpleProperty
Definition: SimpleProperty.java:23
com.google.appinventor.components.runtime.VideoPlayer.getPassedWidth
int getPassedWidth()
Definition: VideoPlayer.java:607
com.google.appinventor.components.annotations.PropertyCategory
Definition: PropertyCategory.java:13
com.google.appinventor.components.runtime.VideoPlayer.Completed
void Completed()
Definition: VideoPlayer.java:388
com.google.appinventor.components.runtime.util.ErrorMessages.ERROR_VIDEOPLAYER_FULLSCREEN_UNAVAILBLE
static final int ERROR_VIDEOPLAYER_FULLSCREEN_UNAVAILBLE
Definition: ErrorMessages.java:150
com.google.appinventor.components.runtime.errors.PermissionException
Definition: PermissionException.java:16
com.google.appinventor.components.runtime.ComponentContainer
Definition: ComponentContainer.java:16
com.google.appinventor.components.runtime.util.SdkLevel.getLevel
static int getLevel()
Definition: SdkLevel.java:45
com.google.appinventor.components.runtime.VideoPlayer.fullScreenKilled
void fullScreenKilled(Bundle data)
Definition: VideoPlayer.java:589
com.google.appinventor.components.runtime
Copyright 2009-2011 Google, All Rights reserved.
Definition: AccelerometerSensor.java:8
com.google.appinventor.components.runtime.util.FullScreenVideoUtil.FULLSCREEN_VIDEO_ACTION_FULLSCREEN
static final int FULLSCREEN_VIDEO_ACTION_FULLSCREEN
Definition: FullScreenVideoUtil.java:55
com.google.appinventor.components.runtime.Deleteable
Definition: Deleteable.java:15
com.google.appinventor.components.common
Definition: ComponentCategory.java:7
com.google.appinventor.components.runtime.VideoPlayer.VideoPlayer
VideoPlayer(ComponentContainer container)
Definition: VideoPlayer.java:151
com.google.appinventor.components.runtime.util.ErrorMessages.ERROR_VIDEOPLAYER_FULLSCREEN_UNSUPPORTED
static final int ERROR_VIDEOPLAYER_FULLSCREEN_UNSUPPORTED
Definition: ErrorMessages.java:152
com.google.appinventor.components.common.ComponentCategory
Definition: ComponentCategory.java:48
com.google.appinventor.components.runtime.VideoPlayer.Width
int Width()
Definition: VideoPlayer.java:474
com.google.appinventor.components.annotations.SimpleObject
Definition: SimpleObject.java:23
com.google.appinventor.components.runtime.VideoPlayer.onCompletion
void onCompletion(MediaPlayer m)
Definition: VideoPlayer.java:380
com.google.appinventor.components.runtime.util.FullScreenVideoUtil.FULLSCREEN_VIDEO_ACTION_PLAY
static final int FULLSCREEN_VIDEO_ACTION_PLAY
Definition: FullScreenVideoUtil.java:47
com.google
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_NON_NEGATIVE_FLOAT
static final String PROPERTY_TYPE_NON_NEGATIVE_FLOAT
Definition: PropertyTypeConstants.java:200
com.google.appinventor.components.runtime.util.MediaUtil.loadVideoView
static void loadVideoView(VideoView videoView, Form form, String mediaPath)
Definition: MediaUtil.java:793
com
com.google.appinventor.components.runtime.util.FullScreenVideoUtil.VIDEOPLAYER_FULLSCREEN
static final String VIDEOPLAYER_FULLSCREEN
Definition: FullScreenVideoUtil.java:59
com.google.appinventor.components.runtime.errors
Definition: ArrayIndexOutOfBoundsError.java:7
com.google.appinventor.components.runtime.ComponentContainer.$form
Form $form()
com.google.appinventor.components.runtime.ComponentContainer.$context
Activity $context()
com.google.appinventor.components.runtime.VideoPlayer.Source
void Source(String path)
Definition: VideoPlayer.java:197
com.google.appinventor.components.common.ComponentConstants
Definition: ComponentConstants.java:13
com.google.appinventor.components.common.ComponentConstants.VIDEOPLAYER_PREFERRED_WIDTH
static final int VIDEOPLAYER_PREFERRED_WIDTH
Definition: ComponentConstants.java:44
com.google.appinventor.components.runtime.util.FullScreenVideoUtil.FULLSCREEN_VIDEO_ACTION_SEEK
static final int FULLSCREEN_VIDEO_ACTION_SEEK
Definition: FullScreenVideoUtil.java:45
com.google.appinventor.components.runtime.AndroidViewComponent
Definition: AndroidViewComponent.java:27
com.google.appinventor.components.runtime.VideoPlayer.FullScreen
boolean FullScreen()
Definition: VideoPlayer.java:526
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_ASSET
static final String PROPERTY_TYPE_ASSET
Definition: PropertyTypeConstants.java:22
com.google.appinventor.components.runtime.VideoPlayer.onPrepared
void onPrepared(MediaPlayer newMediaPlayer)
Definition: VideoPlayer.java:418
com.google.appinventor.components.common.PropertyTypeConstants
Definition: PropertyTypeConstants.java:14
com.google.appinventor.components.runtime.OnDestroyListener
Definition: OnDestroyListener.java:15
com.google.appinventor.components.annotations
com.google.appinventor.components.runtime.util.FullScreenVideoUtil.VIDEOPLAYER_PLAYING
static final String VIDEOPLAYER_PLAYING
Definition: FullScreenVideoUtil.java:61
com.google.appinventor