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


Java VideoView.setOnPreparedListener方法代码示例

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


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

示例1: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
protected final void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mContentView = new VideoView(this);
    mContentView.setVisibility(View.GONE);
    mContentView.setOnPreparedListener(new OnPreparedListener());

    final FrameLayout.LayoutParams layoutParams =
            new FrameLayout.LayoutParams(
                    FrameLayout.LayoutParams.WRAP_CONTENT,
                    FrameLayout.LayoutParams.WRAP_CONTENT,
                    Gravity.CENTER);
    mContentView.setLayoutParams(layoutParams);

    setContentView(mContentView);

    startEncode(new File(getFilesDir(), OUTPUT_FILE_NAME).getAbsolutePath());
}
 
开发者ID:Nik-Gleb,项目名称:mpeg-encoder,代码行数:21,代码来源:MainActivity.java

示例2: go

import android.widget.VideoView; //导入方法依赖的package包/类
private void go() {
VideoView v=(VideoView)findViewById(R.id.videoView) ;
        final ProgressBar p=(ProgressBar)findViewById(R.id.progressBar3);
        v.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                p.setVisibility(View.GONE);
            }
        });
        String s="https://firebasestorage.googleapis.com/v0/b/lifesaver-18f28.appspot.com/o/flood.mp4?alt=media&token=179d7e4e-7171-4a87-b1f8-b1fc3d976c60";
        Uri uri=Uri.parse(s);
        v.setVideoURI(uri);
        v.setVideoPath(s);
        v.requestFocus();
        v.start();


    }
 
开发者ID:iamjaspreetsingh,项目名称:LifeSaver,代码行数:19,代码来源:Main4Activity.java

示例3: go

import android.widget.VideoView; //导入方法依赖的package包/类
private void go() {
        final ProgressBar p=(ProgressBar)findViewById(R.id.progressBar2);
        VideoView v=(VideoView)findViewById(R.id.videoView2) ;
v.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
    @Override
    public void onPrepared(MediaPlayer mp) {
        p.setVisibility(View.GONE);
    }
});
String s="https://firebasestorage.googleapis.com/v0/b/lifesaver-18f28.appspot.com/o/earthquake.mp4?alt=media&token=98993371-823d-4b81-adc7-d9d87ec841a9";
        Uri uri=Uri.parse(s);
        v.setVideoURI(uri);
         v.setVisibility(View.VISIBLE);
         v.setVideoPath(s);
        v.requestFocus();
        v.start();





    }
 
开发者ID:iamjaspreetsingh,项目名称:LifeSaver,代码行数:23,代码来源:Main3Activity.java

示例4: 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

示例5: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    String url = getIntent().getExtras().getString(Constants.URL);
    setContentView(R.layout.fragment_video_gallery);
    final VideoView videoView = (VideoView) findViewById(R.id.videoView);
    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            View progress = findViewById(R.id.videoProgress);
            progress.setVisibility(View.GONE);

            videoView.requestFocus();
            MediaController vidControl = new MediaController(VideoPlayerActivity.this);
            vidControl.setAnchorView(videoView);
            videoView.setMediaController(vidControl);
            videoView.start();
        }
    });
    videoView.setVideoURI(Uri.parse(url));
}
 
开发者ID:yangchong211,项目名称:YCGallery,代码行数:22,代码来源:VideoPlayerActivity.java

示例6: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.video_full);
    videofull=(VideoView)findViewById(R.id.videofull);
    videofull.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.video));
    videofull.setMediaController(new MediaController(VideoFull.this));
    videofull.start();
    videofull.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            mp.setLooping(true);
        }
    });
    videofull.requestFocus();
}
 
开发者ID:siddhantvinchurkar,项目名称:Marv,代码行数:17,代码来源:VideoFull.java

示例7: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    String url = getIntent().getExtras().getString(Constants.URL);
    setContentView(R.layout.video_fragment);
    final VideoView videoView = (VideoView) findViewById(R.id.videoView);
    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            View progress = findViewById(R.id.videoProgress);
            progress.setVisibility(View.GONE);

            videoView.requestFocus();
            MediaController vidControl = new MediaController(VideoPlayerActivity.this);
            vidControl.setAnchorView(videoView);
            videoView.setMediaController(vidControl);
            videoView.start();
        }
    });
    videoView.setVideoURI(Uri.parse(url));
}
 
开发者ID:PM-Martin,项目名称:ScrollGallery-android,代码行数:22,代码来源:VideoPlayerActivity.java

示例8: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    VideoView videoView = (VideoView) findViewById(R.id.video_view);
    final String uri = "android.resource://" + getPackageName() + "/" + R.raw.fix_429;
    videoView.setVideoURI(Uri.parse(uri));
    // Loop
    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            mp.setLooping(true);
        }
    });
    // Play
    videoView.start();
}
 
开发者ID:wequick,项目名称:Small,代码行数:21,代码来源:VideoActivity.java

示例9: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onCreate (Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.example_layout);
    getActionBar().setLogo(R.drawable.ic_launcher);
    mController = (VideoController)findViewById(R.id.controller);
    mVideoView = (VideoView)findViewById(R.id.video_view);
    mVideoView.setOnPreparedListener(onPreparedListener);
    mController.setMediaPlayer(mVideoView);
    mController.setOnControllerShowListener(controllerShowListener);
    Options options = new Options();
    options.tag = "default";
    options.key = "test_key";
    mProxyServer = new ProxyServer(options,this,abstractMediaPlayer);
    findViewById(R.id.frame).setOnTouchListener(controllerToggler);
    mProxyServer.open();
}
 
开发者ID:inventos,项目名称:FlockPlay-android,代码行数:20,代码来源:MainActivity.java

示例10: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    SettingUtilities.onActivityCreateSetTheme(this);
    setContentView(R.layout.activity_help);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    findViewById(R.id.btnFeedback).setOnClickListener(this);

    try {
        final VideoView videoView = (VideoView) findViewById(R.id.videoView);
        Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.trimme);
        videoView.setVideoURI(uri);
        videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {

            @Override
            public void onPrepared(MediaPlayer mp) {
                mp.setLooping(true);
                videoView.start();
            }
        });

    } catch (Exception ex) {
        Log.e("Help video", ex.getMessage(), ex);
    }
}
 
开发者ID:eyeRS,项目名称:eyeRS,代码行数:28,代码来源:HelpActivity.java

示例11: init

import android.widget.VideoView; //导入方法依赖的package包/类
private void init() {
    //Authentication and authorization of App and SDK
    MemeLib.setAppClientID(getApplicationContext(), APP_ID, APP_SECRET);
    memeLib = MemeLib.getInstance();

    blinkLayout = (FrameLayout)findViewById(R.id.blink_layout);

    blinkImage = (ImageView)findViewById(R.id.blink_image);

    blinkView = (VideoView)findViewById(R.id.blink_view);
    blinkView.setZOrderOnTop(true);
    blinkView.setVideoPath("android.resource://" + this.getPackageName() + "/" + R.raw.blink);
    blinkView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mediaPlayer) {
            mediaPlayer.seekTo(0);
        }
    });

    bodyLayout = (FrameLayout)findViewById(R.id.body_layout);

    bodyImage = (ImageView)findViewById(R.id.body_image);

    statusLabel = (TextView)findViewById(R.id.status_label);

    connectButton = (Button)findViewById(R.id.connect_button);
    connectButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (memeLib.isConnected()) {
                memeLib.disconnect();
            } else {
                Intent intent = new Intent(LiveViewActivity.this, ConnectActivity.class);
                startActivity(intent);
            }
        }
    });

    changeViewStatus(memeLib.isConnected());
}
 
开发者ID:jins-meme,项目名称:JinsMemeSDK-Sample-Android,代码行数:41,代码来源:LiveViewActivity.java

示例12: onCreate

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_start);

    videoView = (VideoView) findViewById(R.id.video_background);

    Controller controller = new Controller(getApplicationContext());
    controller.setRandomNumber();

    TextView text_welcome = (TextView) findViewById(R.id.text_welcome);
    text_welcome.setText(controller.getWelcomeText());

    Uri path = Uri.parse("android.resource://co.encuentralofacil/" + controller.getVideo());
    videoView.setVideoURI(path);
    videoView.start();
    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            mp.setLooping(true);
        }
    });

    Button button_sign_up = (Button) findViewById(R.id.button_sign_up);
    button_sign_up.setOnClickListener(this);
    Button button_log_in = (Button) findViewById(R.id.button_log_in);
    button_log_in.setOnClickListener(this);
    TextView text_later = (TextView) findViewById(R.id.text_later);
    text_later.setOnClickListener(this);
}
 
开发者ID:EstebanC02,项目名称:EncuentraloFacil-Android,代码行数:31,代码来源:StartActivity.java

示例13: 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

示例14: onViewCreated

import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState){
    super.onViewCreated(view, savedInstanceState);

    calibrationProgress = (ProgressBar) view.findViewById(R.id.compass_calibration_progress);
    instructionsContainer = view.findViewById(R.id.compass_calibration_instructions_container);
    calibrationInstructions = (TextView) view.findViewById(R.id.compass_calibration_instructions);
    calibrationImage = (ImageView) view.findViewById(R.id.compass_calibration_image);

    calibrationVideo = (VideoView) view.findViewById(R.id.compass_calibration_video);
    calibrationVideo.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            mp.setLooping(true);
        }
    });
    calibrationVideo.setVideoURI(Uri.parse("android.resource://" + getContext().getPackageName() + "/" +
        R.raw.compass_cal_white));

    calibrationButton = (TextView) view.findViewById(R.id.compass_calibration_button);
    calibrationButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            proceedWithCalibration(calibrationStep);
        }
    });

    advicesContainer = view.findViewById(R.id.compass_calibration_advices_container);

    @CompassCalibrationStep int currentStep = savedInstanceState == null
        ? STEP_BEGIN_CALIBRATION
        : savedInstanceState.getInt(EXTRA_CALIBRATION_STEP, STEP_BEGIN_CALIBRATION);

    calibrationStep = currentStep;
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:36,代码来源:FragmentSetupCompass.java

示例15: onCreate

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

    // Get a reference to the VideoView

    mVideoView = (VideoView) findViewById(R.id.videoViewer);

    // Add a Media controller to allow forward/reverse/pause/resume

    final MediaController mMediaController = new MediaController(
            VideoPlayActivity.this, true);

    mMediaController.setEnabled(false);

    mVideoView.setMediaController(mMediaController);

    mVideoView
            .setVideoURI(Uri
                    .parse("android.resource://qa.edu.qu.cse.cmps312.multimedia/raw/theeb"));

    // Add an OnPreparedListener to enable the MediaController once the video is ready
    mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {

        @Override
        public void onPrepared(MediaPlayer mp) {
            mMediaController.setEnabled(true);
        }
    });
}
 
开发者ID:abdulla-alali,项目名称:lecture_examples,代码行数:32,代码来源:VideoPlayActivity.java


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