當前位置: 首頁>>代碼示例>>Java>>正文


Java SurfaceHolder.getSurface方法代碼示例

本文整理匯總了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);
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:23,代碼來源:CameraView.java

示例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();
}
 
開發者ID:yuriy-budiyev,項目名稱:code-scanner,代碼行數:10,代碼來源:CodeScanner.java

示例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);
    }
}
 
開發者ID:tohodog,項目名稱:QSVideoPlayer,代碼行數:13,代碼來源:AndroidMedia.java

示例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);
}
 
開發者ID:MartinRGB,項目名稱:android_camera_experiment,代碼行數:16,代碼來源:Camera1Manager.java

示例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);
    }
}
 
開發者ID:tohodog,項目名稱:QSVideoPlayer,代碼行數:13,代碼來源:ExoMedia.java

示例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();
	}
});
  }
 
開發者ID:zuoweitan,項目名稱:Hitalk,代碼行數:14,代碼來源:CameraPreview.java

示例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);
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:12,代碼來源:CameraView.java

示例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();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:11,代碼來源:CameraView.java

示例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);
}
 
開發者ID:MartinRGB,項目名稱:android_camera_experiment,代碼行數:16,代碼來源:Camera1Manager.java

示例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();
}
 
開發者ID:lydia-schiff,項目名稱:hella-renderscript,代碼行數:10,代碼來源:BaseViewfinderActivity.java

示例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();
    }
}
 
開發者ID:Tai-Kimura,項目名稱:VideoApplication,代碼行數:13,代碼來源:VideoPlayActivity.java

示例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);
}
 
開發者ID:AndyZhu1991,項目名稱:grafika,代碼行數:14,代碼來源:ColorBarActivity.java

示例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();
}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:12,代碼來源:AvosMediaPlayer.java

示例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();
  }
}
 
開發者ID:Leavessilent,項目名稱:QuanMinTV,代碼行數:18,代碼來源:MediaPlayer.java

示例15: surfaceChanged

import android.view.SurfaceHolder; //導入方法依賴的package包/類
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
    if (surfaceHolder.getSurface() != null) {
        stopCameraPreview();
        showCameraPreview();
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:7,代碼來源:CameraPreview.java


注:本文中的android.view.SurfaceHolder.getSurface方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。