本文整理匯總了Java中android.view.SurfaceHolder.getSurface方法的典型用法代碼示例。如果您正苦於以下問題:Java SurfaceHolder.getSurface方法的具體用法?Java SurfaceHolder.getSurface怎麽用?Java SurfaceHolder.getSurface使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.SurfaceHolder
的用法示例。
在下文中一共展示了SurfaceHolder.getSurface方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: surfaceChangedUi
import android.view.SurfaceHolder; //導入方法依賴的package包/類
@UiThread
private void surfaceChangedUi(SurfaceHolder holder, int w, int h) {
if (LOG.isLoggable(INFO)) LOG.info("Surface changed: " + w + "x" + h);
if (surface != null && surface != holder.getSurface()) {
LOG.info("Releasing old surface");
surface.release();
}
surface = holder.getSurface();
surfaceWidth = w;
surfaceHeight = h;
if (camera == null) return; // We are stopped
stopPreview();
try {
Parameters params = camera.getParameters();
setPreviewSize(params);
camera.setParameters(params);
logCameraParameters();
} catch (RuntimeException e) {
LOG.log(WARNING, "Error setting preview size", e);
}
startPreview(holder);
}
示例2: surfaceChanged
import android.view.SurfaceHolder; //導入方法依賴的package包/類
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
if (holder.getSurface() == null) {
mPreviewActive = false;
return;
}
stopPreviewInternalSafe();
startPreviewInternalSafe();
}
示例3: setDisplay
import android.view.SurfaceHolder; //導入方法依賴的package包/類
@Override
public void setDisplay(SurfaceHolder surfaceHolder) {
try {
if (mediaPlayer != null)
mediaPlayer.setDisplay(surfaceHolder);
if (surfaceHolder != null)
this.surface = surfaceHolder.getSurface();
} catch (Exception e) {
e.printStackTrace();
onError(mediaPlayer, MEDIA_ERROR_UNKNOWN, MEDIA_ERROR_UNKNOWN);
}
}
示例4: surfaceCreated
import android.view.SurfaceHolder; //導入方法依賴的package包/類
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder) {
if (surfaceHolder.getSurface() == null) {
return;
}
surface = surfaceHolder.getSurface();
try {
camera.stopPreview();
} catch (Exception ignore) {
}
startPreview(surfaceHolder);
}
示例5: setDisplay
import android.view.SurfaceHolder; //導入方法依賴的package包/類
@Override
public void setDisplay(SurfaceHolder surfaceHolder) {
try {
if (simpleExoPlayer != null)
simpleExoPlayer.setVideoSurfaceHolder(surfaceHolder);
if (surfaceHolder != null)
this.surface = surfaceHolder.getSurface();
} catch (Exception e) {
e.printStackTrace();
iMediaCallback.onError(this, 10010, 10010);
}
}
示例6: surfaceChanged
import android.view.SurfaceHolder; //導入方法依賴的package包/類
@Override
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
if (surfaceHolder.getSurface() == null) {
return;
}
stopCameraPreview();
post(new Runnable(){
public void run(){
showCameraPreview();
}
});
}
示例7: surfaceCreatedUi
import android.view.SurfaceHolder; //導入方法依賴的package包/類
@UiThread
private void surfaceCreatedUi(SurfaceHolder holder) {
LOG.info("Surface created");
if (surface != null && surface != holder.getSurface()) {
LOG.info("Releasing old surface");
surface.release();
}
surface = holder.getSurface();
// Start the preview when the camera and the surface are both ready
if (camera != null && !previewStarted) startPreview(holder);
}
示例8: surfaceDestroyedUi
import android.view.SurfaceHolder; //導入方法依賴的package包/類
@UiThread
private void surfaceDestroyedUi(SurfaceHolder holder) {
LOG.info("Surface destroyed");
if (surface != null && surface != holder.getSurface()) {
LOG.info("Releasing old surface");
surface.release();
}
surface = null;
holder.getSurface().release();
}
示例9: surfaceChanged
import android.view.SurfaceHolder; //導入方法依賴的package包/類
@Override
public void surfaceChanged(SurfaceHolder surfaceHolder, int format, int width, int height) {
if (surfaceHolder.getSurface() == null) {
return;
}
surface = surfaceHolder.getSurface();
try {
camera.stopPreview();
} catch (Exception ignore) {
}
startPreview(surfaceHolder);
}
示例10: surfaceChanged
import android.view.SurfaceHolder; //導入方法依賴的package包/類
/**
* Callbacks for the FixedAspectSurfaceView
*/
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
mPreviewSurface = holder.getSurface();
configureSurfaces();
}
示例11: surfaceCreated
import android.view.SurfaceHolder; //導入方法依賴的package包/類
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder) {
try {
File folder = Environment.getExternalStorageDirectory();
File file = new File(videoPath);
moviePlayer = new MoviePlayer(file, surfaceHolder.getSurface());
moviePlayer.setProgressListener(VideoPlayActivity.this);
moviePlayer.setListener(this);
} catch (IOException e) {
e.printStackTrace();
}
}
示例12: surfaceChanged
import android.view.SurfaceHolder; //導入方法依賴的package包/類
/**
* SurfaceHolder.Callback method
* <p>
* Draws when the surface changes. Since nothing else is touching the surface, and
* we're not animating, we just draw here and ignore it.
*/
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
Log.v(TAG, "surfaceChanged fmt=" + format + " size=" + width + "x" + height +
" holder=" + holder);
Surface surface = holder.getSurface();
drawColorBars(surface);
}
示例13: setDisplay
import android.view.SurfaceHolder; //導入方法依賴的package包/類
public void setDisplay(SurfaceHolder sh) {
mSurfaceHolder = sh;
Surface surface;
if (sh != null) {
surface = sh.getSurface();
} else {
surface = null;
}
setVideoSurface(surface);
updateSurfaceScreenOn();
}
示例14: setDisplay
import android.view.SurfaceHolder; //導入方法依賴的package包/類
/**
* Sets the SurfaceHolder to use for displaying the video portion of the
* media. This call is optional. Not calling it when playing back a video will
* result in only the audio track being played.
*
* @param sh the SurfaceHolder to use for video display
*/
public void setDisplay(SurfaceHolder sh) {
if (sh == null) {
releaseDisplay();
} else {
mSurfaceHolder = sh;
mSurface = sh.getSurface();
_setVideoSurface(mSurface);
updateSurfaceScreenOn();
}
}
示例15: surfaceChanged
import android.view.SurfaceHolder; //導入方法依賴的package包/類
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
if (surfaceHolder.getSurface() != null) {
stopCameraPreview();
showCameraPreview();
}
}