当前位置: 首页>>代码示例>>Java>>正文


Java VideoView.setOnErrorListener方法代码示例

本文整理汇总了Java中android.widget.VideoView.setOnErrorListener方法的典型用法代码示例。如果您正苦于以下问题:Java VideoView.setOnErrorListener方法的具体用法?Java VideoView.setOnErrorListener怎么用?Java VideoView.setOnErrorListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.VideoView的用法示例。


在下文中一共展示了VideoView.setOnErrorListener方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initPlayer

import android.widget.VideoView; //导入方法依赖的package包/类
public static void initPlayer(VideoView videoView, OnPreparedListener onPreparedListener,
                              OnCompletionListener onCompletionListener, OnErrorListener
                                      onErrorListener) {
    if (onPreparedListener != null) {
        videoView.setOnPreparedListener(onPreparedListener);
    }
    if (onCompletionListener != null) {
        videoView.setOnCompletionListener(onCompletionListener);
    }
    if (onErrorListener != null) {
        videoView.setOnErrorListener(onErrorListener);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:14,代码来源:VideoPlayerManager.java

示例2: VideoPlayer

import android.widget.VideoView; //导入方法依赖的package包/类
/**
 * Creates a new VideoPlayer component.
 *
 * @param container
 */
public VideoPlayer(ComponentContainer container) {
  super(container);
  
  videoView = new VideoView(container.$context());
  videoView.setMediaController(new MediaController(container.$context()));
  videoView.setOnCompletionListener(this);
  videoView.setOnErrorListener(this);

  // add the component to the designated container
  container.$add(this);
  // set a default size
  container.setChildWidth(this, ComponentConstants.VIDEOPLAYER_PREFERRED_WIDTH);
  container.setChildHeight(this, ComponentConstants.VIDEOPLAYER_PREFERRED_HEIGHT);
  container.$form().registerForOnInitialize(this);
  sourcePath = "";
}
 
开发者ID:roadlabs,项目名称:alternate-java-bridge-library,代码行数:22,代码来源:VideoPlayer.java

示例3: onShowCustomView

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onShowCustomView(View view, int requestedOrientation, CustomViewCallback callback) {
	if (view == null) {
		return;
	}
	if (mCustomView != null && callback != null) {
		callback.onCustomViewHidden();
		return;
	}
	try {
		view.setKeepScreenOn(true);
	} catch (SecurityException e) {
		Log.e(Constants.TAG, "WebView is not allowed to keep the screen on");
	}
	mOriginalOrientation = getRequestedOrientation();
	FrameLayout decor = (FrameLayout) getWindow().getDecorView();
	mFullscreenContainer = new FullscreenHolder(this);
	mCustomView = view;
	mFullscreenContainer.addView(mCustomView, COVER_SCREEN_PARAMS);
	decor.addView(mFullscreenContainer, COVER_SCREEN_PARAMS);
	setFullscreen(true);
	getCurrentWebView().setVisibility(View.GONE);
	if (view instanceof FrameLayout) {
		if (((FrameLayout) view).getFocusedChild() instanceof VideoView) {
			mVideoView = (VideoView) ((FrameLayout) view).getFocusedChild();
			mVideoView.setOnErrorListener(new VideoCompletionListener());
			mVideoView.setOnCompletionListener(new VideoCompletionListener());
		}
	}
	mCustomViewCallback = callback;
}
 
开发者ID:NewCasino,项目名称:browser,代码行数:32,代码来源:BrowserActivity.java

示例4: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
/**
 *  Called when the activity is first created.
 *
 *  Searches for an {@link OCFile} and ownCloud {@link Account} holding it in the starting {@link Intent}.
 *
 *  The {@link Account} is unnecessary if the file is downloaded; else, the {@link Account} is used to
 *  try to stream the remote file - TODO get the streaming works
 *
 *  {@inheritDoc}
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log_OC.v(TAG, "onCreate");

    setContentView(R.layout.video_layout);

    if (savedInstanceState == null) {
        Bundle extras = getIntent().getExtras();
        mSavedPlaybackPosition = extras.getInt(EXTRA_START_POSITION);
        mAutoplay = extras.getBoolean(EXTRA_AUTOPLAY);

    } else {
        mSavedPlaybackPosition = savedInstanceState.getInt(EXTRA_START_POSITION);
        mAutoplay = savedInstanceState.getBoolean(EXTRA_AUTOPLAY);
    }

    mVideoPlayer = (VideoView) findViewById(R.id.videoPlayer);

    // set listeners to get more contol on the playback
    mVideoPlayer.setOnPreparedListener(this);
    mVideoPlayer.setOnCompletionListener(this);
    mVideoPlayer.setOnErrorListener(this);

    // keep the screen on while the playback is performed (prevents screen off by battery save)
    mVideoPlayer.setKeepScreenOn(true);
}
 
开发者ID:skymania,项目名称:Cirrus,代码行数:38,代码来源:PreviewVideoActivity.java

示例5: onShowCustomView

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
    if (view == null) {
        return;
    }
    if (mCustomView != null && callback != null) {
        callback.onCustomViewHidden();
        return;
    }
    try {
        view.setKeepScreenOn(true);
    } catch (SecurityException e) {
        Log.e(Constants.TAG, "WebView is not allowed to keep the screen on");
    }
    mOriginalOrientation = getRequestedOrientation();
    FrameLayout decor = (FrameLayout) getWindow().getDecorView();
    mFullscreenContainer = new FrameLayout(this);
    mFullscreenContainer.setBackgroundColor(ContextCompat.getColor(this, android.R.color.black));
    mCustomView = view;
    mFullscreenContainer.addView(mCustomView, COVER_SCREEN_PARAMS);
    decor.addView(mFullscreenContainer, COVER_SCREEN_PARAMS);
    setFullscreen(true, true);
    mCurrentView.setVisibility(View.GONE);
    if (view instanceof FrameLayout) {
        if (((FrameLayout) view).getFocusedChild() instanceof VideoView) {
            mVideoView = (VideoView) ((FrameLayout) view).getFocusedChild();
            mVideoView.setOnErrorListener(new VideoCompletionListener());
            mVideoView.setOnCompletionListener(new VideoCompletionListener());
        }
    }
    mCustomViewCallback = callback;
}
 
开发者ID:javadtaghia,项目名称:DeeBrowser,代码行数:33,代码来源:BrowserActivity.java

示例6: MraidVideoViewController

import android.widget.VideoView; //导入方法依赖的package包/类
public MraidVideoViewController(final Context context,
        final Bundle intentExtras,
        final Bundle savedInstanceState,
        final BaseVideoViewControllerListener baseVideoViewControllerListener) {
    // No broadcast identifiers are used by MraidVideoViews.
    super(context, null, baseVideoViewControllerListener);

    mVideoView = new VideoView(context);
    mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
        @Override
        public void onCompletion(MediaPlayer mp) {
            mCloseButton.setVisibility(VISIBLE);
            videoCompleted(true);
        }
    });

    mVideoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {
        @Override
        public boolean onError(MediaPlayer mediaPlayer, int what, int extra) {
            mCloseButton.setVisibility(VISIBLE);
            videoError(false);

            return false;
        }
    });

    mVideoView.setVideoPath(intentExtras.getString(VIDEO_URL));
}
 
开发者ID:JSafaiyeh,项目名称:Fabric-Example-App-Android,代码行数:29,代码来源:MraidVideoViewController.java

示例7: initViews

import android.widget.VideoView; //导入方法依赖的package包/类
protected void initViews() {
	mSpinningProgressBar = (ProgressBar) findViewById( R.id.progress_spinner );

	mVideoView = (VideoView) findViewById( R.id.video_view );
	mVideoView.setOnCompletionListener( onCompletionListener );
	mVideoView.setOnErrorListener( onErrorListener );
	mVideoView.setOnPreparedListener( onPreparedListener );

	if( mVideoView == null ) {
		throw new IllegalArgumentException( "Layout must contain a video view with ID video_view" );
	}

	mUri = Uri.parse( getIntent().getExtras().getString( EXTRA_VIDEO_URL ) );
	mVideoView.setVideoURI( mUri );
}
 
开发者ID:Lakkichand,项目名称:AndroidDemoProjects,代码行数:16,代码来源:VideoPlayerActivity.java

示例8: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    mContext = getApplicationContext();
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_ACTION_BAR);
    requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);

    ActionBar actionBar = getActionBar();
    int displayOptions = ActionBar.DISPLAY_SHOW_HOME;
    actionBar.setDisplayOptions(0, displayOptions);
    displayOptions = ActionBar.DISPLAY_SHOW_CUSTOM;
    actionBar.setDisplayOptions(displayOptions, displayOptions);
    actionBar.setCustomView(R.layout.trim_menu);

    mSaveVideoTextView = (TextView) findViewById(R.id.start_trim);
    mSaveVideoTextView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
            trimVideo();
        }
    });
    mSaveVideoTextView.setEnabled(false);

    Intent intent = getIntent();
    mUri = intent.getData();
    mSrcVideoPath = intent.getStringExtra(PhotoPage.KEY_MEDIA_ITEM_PATH);
    setContentView(R.layout.trim_view);
    View rootView = findViewById(R.id.trim_view_root);

    mVideoView = (VideoView) rootView.findViewById(R.id.surface_view);

    mController = new TrimControllerOverlay(mContext);
    ((ViewGroup) rootView).addView(mController.getView());
    mController.setListener(this);
    mController.setCanReplay(true);

    mVideoView.setOnErrorListener(this);
    mVideoView.setOnCompletionListener(this);
    mVideoView.setVideoURI(mUri);

    playVideo();
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:44,代码来源:TrimVideo.java


注:本文中的android.widget.VideoView.setOnErrorListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。