AI2 Component
(Version nb184)
|
Classes | |
class | ResizableVideoView |
Public Member Functions | |
VideoPlayer (ComponentContainer container) | |
View | getView () |
void | Source (String path) |
void | Start () |
void | Volume (int vol) |
void | delayedStart () |
void | Pause () |
void | Stop () |
void | SeekTo (int ms) |
int | GetDuration () |
void | onCompletion (MediaPlayer m) |
void | Completed () |
boolean | onError (MediaPlayer m, int what, int extra) |
void | onPrepared (MediaPlayer newMediaPlayer) |
void | VideoPlayerError (String message) |
void | onDestroy () |
void | onDelete () |
int | Width () |
void | Width (int width) |
int | Height () |
void | Height (int height) |
boolean | FullScreen () |
void | FullScreen (boolean value) |
void | fullScreenKilled (Bundle data) |
int | getPassedWidth () |
int | getPassedHeight () |
Public Member Functions inherited from com.google.appinventor.components.runtime.AndroidViewComponent | |
boolean | Visible () |
void | Visible (boolean visibility) |
void | WidthPercent (int pCent) |
void | setLastWidth (int width) |
int | getSetWidth () |
void | setLastHeight (int height) |
int | getSetHeight () |
void | CopyWidth (AndroidViewComponent sourceComponent) |
void | HeightPercent (int pCent) |
void | CopyHeight (AndroidViewComponent sourceComponent) |
int | Column () |
void | Column (int column) |
int | Row () |
void | Row (int row) |
HandlesEventDispatching | getDispatchDelegate () |
Additional Inherited Members | |
Static Public Attributes inherited from com.google.appinventor.components.runtime.Component | |
static final String | ASSET_DIRECTORY = "component" |
static final int | ALIGNMENT_NORMAL = 0 |
static final int | ALIGNMENT_CENTER = 1 |
static final int | ALIGNMENT_OPPOSITE = 2 |
static final int | ACCELEROMETER_SENSITIVITY_WEAK = 1 |
static final int | ACCELEROMETER_SENSITIVITY_MODERATE = 2 |
static final int | ACCELEROMETER_SENSITIVITY_STRONG = 3 |
static final int | BUTTON_SHAPE_DEFAULT = 0 |
static final int | BUTTON_SHAPE_ROUNDED = 1 |
static final int | BUTTON_SHAPE_RECT = 2 |
static final int | BUTTON_SHAPE_OVAL = 3 |
static final int | COLOR_NONE = 0x00FFFFFF |
static final int | COLOR_BLACK = 0xFF000000 |
static final int | COLOR_BLUE = 0xFF0000FF |
static final int | COLOR_CYAN = 0xFF00FFFF |
static final int | COLOR_DKGRAY = 0xFF444444 |
static final int | COLOR_GRAY = 0xFF888888 |
static final int | COLOR_GREEN = 0xFF00FF00 |
static final int | COLOR_LTGRAY = 0xFFCCCCCC |
static final int | COLOR_MAGENTA = 0xFFFF00FF |
static final int | COLOR_ORANGE = 0xFFFFC800 |
static final int | COLOR_PINK = 0xFFFFAFAF |
static final int | COLOR_RED = 0xFFFF0000 |
static final int | COLOR_WHITE = 0xFFFFFFFF |
static final int | COLOR_YELLOW = 0xFFFFFF00 |
static final int | COLOR_DEFAULT = 0x00000000 |
static final String | DEFAULT_VALUE_COLOR_NONE = "&H00FFFFFF" |
static final String | DEFAULT_VALUE_COLOR_BLACK = "&HFF000000" |
static final String | DEFAULT_VALUE_COLOR_BLUE = "&HFF0000FF" |
static final String | DEFAULT_VALUE_COLOR_CYAN = "&HFF00FFFF" |
static final String | DEFAULT_VALUE_COLOR_DKGRAY = "&HFF444444" |
static final String | DEFAULT_VALUE_COLOR_GRAY = "&HFF888888" |
static final String | DEFAULT_VALUE_COLOR_GREEN = "&HFF00FF00" |
static final String | DEFAULT_VALUE_COLOR_LTGRAY = "&HFFCCCCCC" |
static final String | DEFAULT_VALUE_COLOR_MAGENTA = "&HFFFF00FF" |
static final String | DEFAULT_VALUE_COLOR_ORANGE = "&HFFFFC800" |
static final String | DEFAULT_VALUE_COLOR_PINK = "&HFFFFAFAF" |
static final String | DEFAULT_VALUE_COLOR_RED = "&HFFFF0000" |
static final String | DEFAULT_VALUE_COLOR_WHITE = "&HFFFFFFFF" |
static final String | DEFAULT_VALUE_COLOR_YELLOW = "&HFFFFFF00" |
static final String | DEFAULT_VALUE_COLOR_DEFAULT = "&H00000000" |
static final float | FONT_DEFAULT_SIZE = 14 |
static final int | LAYOUT_ORIENTATION_HORIZONTAL = ComponentConstants.LAYOUT_ORIENTATION_HORIZONTAL |
static final int | LAYOUT_ORIENTATION_VERTICAL = ComponentConstants.LAYOUT_ORIENTATION_VERTICAL |
static final int | SCALING_SCALE_PROPORTIONALLY = 0 |
static final int | SCALING_SCALE_TO_FIT = 1 |
static final int | TYPEFACE_DEFAULT = 0 |
static final int | TYPEFACE_SANSSERIF = 1 |
static final int | TYPEFACE_SERIF = 2 |
static final int | TYPEFACE_MONOSPACE = 3 |
static final int | LENGTH_PREFERRED = -1 |
static final int | LENGTH_FILL_PARENT = -2 |
static final int | LENGTH_UNKNOWN = -3 |
static final int | LENGTH_PERCENT_TAG = -1000 |
static final int | TOAST_LENGTH_SHORT = 0 |
static final int | TOAST_LENGTH_LONG = 1 |
static final int | DIRECTION_NORTH = 1 |
static final int | DIRECTION_NORTHEAST = 2 |
static final int | DIRECTION_EAST = 3 |
static final int | DIRECTION_SOUTHEAST = 4 |
static final int | DIRECTION_SOUTH = -1 |
static final int | DIRECTION_SOUTHWEST = -2 |
static final int | DIRECTION_WEST = -3 |
static final int | DIRECTION_NORTHWEST = -4 |
static final int | DIRECTION_NONE = 0 |
static final int | DIRECTION_MIN = -4 |
static final int | DIRECTION_MAX = 4 |
static float | SLIDER_MIN_VALUE = 10 |
static float | SLIDER_MAX_VALUE = 50 |
static float | SLIDER_THUMB_VALUE = (SLIDER_MIN_VALUE + SLIDER_MAX_VALUE) / 2.0f |
static final String | DEFAULT_VALUE_TEXT_TO_SPEECH_COUNTRY = "" |
static final String | DEFAULT_VALUE_TEXT_TO_SPEECH_LANGUAGE = "" |
Protected Member Functions inherited from com.google.appinventor.components.runtime.AndroidViewComponent | |
AndroidViewComponent (ComponentContainer container) | |
Protected Member Functions inherited from com.google.appinventor.components.runtime.VisibleComponent | |
VisibleComponent () | |
Protected Attributes inherited from com.google.appinventor.components.runtime.AndroidViewComponent | |
final ComponentContainer | container |
TODO: This copies the video from the application's asset directory to a temp file, because the Android VideoView class can't handle assets. Marco plans to include that feature in future releases. TODO: Check that player is prepared (is this necessary?) See if we need to use isPlaying, onErrorListener, and onPreparedListener. TODO: Set up the touch (and trackball?) Simple event handlers so that they interact well with the videoView implementation, i.e., defining handlers should (probably) override videoView making the Mediacontroller appear. TODO: Remove writes of state debugging info to the log after we're sure things are working solidly. TODO: The resizing of the VideoPlayer at runtime does not work well on some devices such as the Motorola Droid. The behavior is almost random when resizing the VideoPlayer on such devices. When App Inventor includes the features to restrict certain devices, the VideoPlayer should be updated. A multimedia component capable of playing videos. When the application is run, the VideoPlayer
will be displayed as a rectangle on-screen. If the user touches the rectangle, controls will appear to play/pause, skip ahead, and skip backward within the video. The application can also control behavior by calling the Start(), Pause(), and SeekTo(int) methods.
Video files should be in 3GPP (.3gp) or MPEG-4 (.mp4) formats. For more details about legal formats, see Android Supported Media Formats.
App Inventor only permits video files under 1 MB and limits the total size of an application to 5 MB, not all of which is available for media (video, audio, and sound) files. If your media files are too large, you may get errors when packaging or installing your application, in which case you should reduce the number of media files or their sizes. Most video editing software, such as Windows Movie Maker and Apple iMovie, can help you decrease the size of videos by shortening them or re-encoding the video into a more compact format.
You can also set the media source to a URL that points to a streaming video, but the URL must point to the video file itself, not to a program that plays the video.
Definition at line 121 of file VideoPlayer.java.
com.google.appinventor.components.runtime.VideoPlayer.VideoPlayer | ( | ComponentContainer | container | ) |
Creates a new VideoPlayer component.
container |
Definition at line 151 of file VideoPlayer.java.
void com.google.appinventor.components.runtime.VideoPlayer.Completed | ( | ) |
Indicates that the video has reached the end
Definition at line 388 of file VideoPlayer.java.
void com.google.appinventor.components.runtime.VideoPlayer.delayedStart | ( | ) |
Method for starting the VideoPlayer once the media has been loaded. Not visible to users.
Definition at line 305 of file VideoPlayer.java.
boolean com.google.appinventor.components.runtime.VideoPlayer.FullScreen | ( | ) |
Returns whether the VideoPlayer's video is currently being shown in fullscreen mode or not.
Definition at line 526 of file VideoPlayer.java.
void com.google.appinventor.components.runtime.VideoPlayer.FullScreen | ( | boolean | value | ) |
Sets whether the video should be shown in fullscreen or not.
value | If True, the video will be shown in fullscreen. If False and VideoPlayer#FullScreen() returns True, fullscreen mode will be exited. If False and VideoPlayer#FullScreen() returns False, nothing occurs. |
Definition at line 539 of file VideoPlayer.java.
void com.google.appinventor.components.runtime.VideoPlayer.fullScreenKilled | ( | Bundle | data | ) |
Notify this VideoPlayer that its video is no longer being shown in fullscreen.
data | See com.google.appinventor.components.runtime.util.FullScreenVideoUtil for an example of what data should contain. |
Definition at line 589 of file VideoPlayer.java.
int com.google.appinventor.components.runtime.VideoPlayer.GetDuration | ( | ) |
Definition at line 362 of file VideoPlayer.java.
int com.google.appinventor.components.runtime.VideoPlayer.getPassedHeight | ( | ) |
Get the value passed in VideoPlayer#Height(int)
Definition at line 615 of file VideoPlayer.java.
int com.google.appinventor.components.runtime.VideoPlayer.getPassedWidth | ( | ) |
Get the value passed in VideoPlayer#Width(int)
Definition at line 607 of file VideoPlayer.java.
View com.google.appinventor.components.runtime.VideoPlayer.getView | ( | ) |
Returns the View that is displayed in the UI.
Reimplemented from com.google.appinventor.components.runtime.AndroidViewComponent.
Definition at line 175 of file VideoPlayer.java.
int com.google.appinventor.components.runtime.VideoPlayer.Height | ( | ) |
Returns the component's vertical height, measured in pixels.
Reimplemented from com.google.appinventor.components.runtime.AndroidViewComponent.
Definition at line 501 of file VideoPlayer.java.
void com.google.appinventor.components.runtime.VideoPlayer.Height | ( | int | height | ) |
Specifies the component's vertical height, measured in pixels.
height | in pixels |
Reimplemented from com.google.appinventor.components.runtime.AndroidViewComponent.
Definition at line 513 of file VideoPlayer.java.
void com.google.appinventor.components.runtime.VideoPlayer.onCompletion | ( | MediaPlayer | m | ) |
Definition at line 380 of file VideoPlayer.java.
void com.google.appinventor.components.runtime.VideoPlayer.onDelete | ( | ) |
Implements com.google.appinventor.components.runtime.Deleteable.
Definition at line 444 of file VideoPlayer.java.
void com.google.appinventor.components.runtime.VideoPlayer.onDestroy | ( | ) |
Implements com.google.appinventor.components.runtime.OnDestroyListener.
Definition at line 437 of file VideoPlayer.java.
boolean com.google.appinventor.components.runtime.VideoPlayer.onError | ( | MediaPlayer | m, |
int | what, | ||
int | extra | ||
) |
Definition at line 395 of file VideoPlayer.java.
void com.google.appinventor.components.runtime.VideoPlayer.onPrepared | ( | MediaPlayer | newMediaPlayer | ) |
Definition at line 418 of file VideoPlayer.java.
void com.google.appinventor.components.runtime.VideoPlayer.Pause | ( | ) |
Pauses playback of the video. Playback can be resumed at the same location by calling the Start() method.
Definition at line 317 of file VideoPlayer.java.
void com.google.appinventor.components.runtime.VideoPlayer.SeekTo | ( | int | ms | ) |
Definition at line 346 of file VideoPlayer.java.
void com.google.appinventor.components.runtime.VideoPlayer.Source | ( | String | path | ) |
Sets the "path" to the video. Usually, this will be the name of the video file, which should be added in the Designer.
@internaldoc See MediaUtil#determineMediaSource for information about what a path can be.
path | the path to the video source |
Definition at line 197 of file VideoPlayer.java.
void com.google.appinventor.components.runtime.VideoPlayer.Start | ( | ) |
Plays the media specified by the Source(String).
@internaldoc These won't normally be used in the most elementary applications, because videoView brings up its own player controls when the video is touched.
Definition at line 260 of file VideoPlayer.java.
void com.google.appinventor.components.runtime.VideoPlayer.Stop | ( | ) |
Definition at line 331 of file VideoPlayer.java.
void com.google.appinventor.components.runtime.VideoPlayer.VideoPlayerError | ( | String | message | ) |
Definition at line 431 of file VideoPlayer.java.
void com.google.appinventor.components.runtime.VideoPlayer.Volume | ( | int | vol | ) |
Sets the volume property to a number between 0 and 100. Values less than 0 will be treated as 0, and values greater than 100 will be treated as 100.
vol | the desired volume level |
Definition at line 291 of file VideoPlayer.java.
int com.google.appinventor.components.runtime.VideoPlayer.Width | ( | ) |
Returns the component's horizontal width, measured in pixels.
Reimplemented from com.google.appinventor.components.runtime.AndroidViewComponent.
Definition at line 474 of file VideoPlayer.java.
void com.google.appinventor.components.runtime.VideoPlayer.Width | ( | int | width | ) |
Specifies the component's horizontal width, measured in pixels.
width | in pixels |
Reimplemented from com.google.appinventor.components.runtime.AndroidViewComponent.
Definition at line 486 of file VideoPlayer.java.