I’m getting error and warning when compile extension
Here the massages
Started Compiling Project StreamVideoPlayer
Buildfile: /compiler/android/build.xml
javac:
[mkdir] Created dir: /compiler/android/build/xVaxF/classes
[javac] Compiling 1 source file to /compiler/android/build/xVaxF/classes
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] /compiler/android/src/xVaxF/in/streamvideoplayer/StreamVideoPlayer.java:3: error: class, interface, or enum expected
[javac] package com.google.appinventor.components.runtime;
[javac] ^
[javac] 1 error
[javac] 1 warning
And Here My JavaScript
package in.streamvideoplayer;
package com.google.appinventor.components.runtime;
import android.content.Context;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.MediaController;
import android.widget.VideoView;
import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.DesignerProperty;
import com.google.appinventor.components.annotations.PropertyCategory;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.annotations.UsesPermissions;
import com.google.appinventor.components.common.Component;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidViewComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.PermissionResultHandler;
import com.google.appinventor.components.runtime.util.ErrorMessages;
import com.google.appinventor.components.runtime.util.MediaUtil;
import com.google.appinventor.components.runtime.util.SdkLevel;
import com.google.appinventor.components.runtime.Component;
import java.io.IOException;
@DesignerComponent(
version = 2,
description = “A multimedia component capable of playing network stream videos.”,
category = ComponentCategory.MEDIA,
iconName = “images/videoPlayer.png”
)
@SimpleObject
@UsesPermissions(permissionNames = “android.permission.INTERNET”)
public class StreamVideoPlayer extends AndroidViewComponent
implements MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener, MediaPlayer.OnPreparedListener {
private final VideoView videoView;
private String videoUrl;
private boolean autoplay = false;
private boolean mediaReady = false;
private boolean delayedStart = false;
private MediaPlayer mediaPlayer;
private final Handler androidUIHandler = new Handler();
public StreamVideoPlayer(ComponentContainer container) {
super(container);
container.$form().registerForOnDestroy(this);
videoView = new VideoView(container.$context());
videoView.setMediaController(new MediaController(container.$context()));
videoView.setOnCompletionListener(this);
videoView.setOnErrorListener(this);
videoView.setOnPreparedListener(this);
container.$add(this);
container.setChildWidth(this, ComponentConstants.VIDEOPLAYER_PREFERRED_WIDTH);
container.setChildHeight(this, ComponentConstants.VIDEOPLAYER_PREFERRED_HEIGHT);
container.$form().setVolumeControlStream(AudioManager.STREAM_MUSIC);
videoUrl = "";
}
@Override
public View getView() {
return videoView;
}
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING, defaultValue = "")
@SimpleProperty(
description = "The URL of the network stream video to play.",
category = PropertyCategory.BEHAVIOR)
public void VideoUrl(String url) {
final String tempUrl = (url == null) ? "" : url;
if (TiramisuUtil.requestVideoPermissions(container.$form(), url,
new PermissionResultHandler() {
@Override
public void HandlePermissionResponse(String permission, boolean granted) {
if (granted) {
StreamVideoPlayer.this.VideoUrl(tempUrl);
} else {
container.$form().dispatchPermissionDeniedEvent(StreamVideoPlayer.this, "VideoUrl",
permission);
}
}
})) {
return;
}
videoUrl = (url == null) ? "" : url;
videoView.setVideoURI(Uri.parse(videoUrl));
videoView.requestFocus();
if (autoplay) {
Start();
}
}
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN, defaultValue = "False")
@SimpleProperty(
description = "Determines whether the video should autoplay when the URL is set.",
category = PropertyCategory.BEHAVIOR)
public void Autoplay(boolean autoplay) {
this.autoplay = autoplay;
}
@SimpleProperty
public boolean Autoplay() {
return autoplay;
}
@SimpleFunction(description = "Starts playback of the video.")
public void Start() {
if (mediaReady) {
videoView.start();
} else {
delayedStart = true;
}
}
@SimpleFunction(description = "Pauses playback of the video.")
public void Pause() {
videoView.pause();
delayedStart = false;
}
@SimpleFunction(description = "Stops playback of the video and seeks to the beginning.")
public void Stop() {
videoView.stopPlayback();
delayedStart = false;
}
@SimpleFunction(
description = "Seeks to the specified position (in milliseconds) in the video.")
public void SeekTo(int milliseconds) {
videoView.seekTo(milliseconds);
}
@SimpleProperty(description = "Returns the duration of the video in milliseconds.")
public int Duration() {
return videoView.getDuration();
}
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
Completed();
}
@SimpleEvent(description = "Event indicating that the video playback has completed.")
public void Completed() {
EventDispatcher.dispatchEvent(this, "Completed");
}
@Override
public boolean onError(MediaPlayer mediaPlayer, int what, int extra) {
mediaReady = false;
delayedStart = false;
container.$form().dispatchErrorOccurredEvent(this, "VideoUrl",
ErrorMessages.ERROR_UNABLE_TO_LOAD_MEDIA, videoUrl);
return true;
}
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
mediaReady = true;
delayedStart = false;
this.mediaPlayer = mediaPlayer;
if (delayedStart) {
Start();
}
}
}
*Please help me to solve this problem.