...
Code Block |
---|
|
/**
* Implementation of an adapter for the {@link VideoView} in standard
* android api.
*
* @author <a href="mailto:support@spring.de">spring GmbH & Co.KG</a>
*/
public class VideoViewAdapter implements StreamAdapter {
private VideoView videoView;
public VideoViewAdapter(VideoView videoView) {
if(videoView == null)
throw new NullPointerException("videoView may not be null");
this.videoView = videoView;
}
@Override
public Meta getMeta() {
return new Meta() {
public String getPlayerName() {
return "android.widget.VideoView";
}
public String getPlayerVersion() {
return Build.VERSION.RELEASE;
}
public int getScreenHeight() {
return (((WindowManager)videoView.getContext().getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay()).getHeight();
}
public int getScreenWidth() {
return (((WindowManager)videoView.getContext().getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay()).getWidth();
}
};
}
@Override
public int getPosition() {
return (int)Math.round(videoView.getCurrentPosition()/1000.0);
}
@Override
public int getDuration() {
return (int)Math.round(videoView.getDuration()/1000.0);
}
@Override
public int getWidth() {
return videoView.getWidth();
}
@Override
public int getHeight() {
return videoView.getHeight();
}
}
|
Appendix B
The source code of class SpringStreamsActivity
...