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


Java IVLCVout.attachViews方法代码示例

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


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

示例1: createPlayer

import org.videolan.libvlc.IVLCVout; //导入方法依赖的package包/类
private void createPlayer() {
    releasePlayer();
    String videoLink = UniversalPlayer.getInstance().getPlayingMediaItem().getAudeoLink();
    try {
        Logger.printInfo(TAG, "Trying to play video: " + videoLink);

        ArrayList<String> options = new ArrayList<String>();
        options.add("--aout=opensles");
        options.add("--audio-time-stretch"); // time stretching
        options.add("-vvv"); // verbosity
        libvlc = new LibVLC(options);
        shVideoHolder.setKeepScreenOn(true);

        // Create media player
        mMediaPlayer = new MediaPlayer(libvlc);
        mMediaPlayer.setEventListener(this);

        // Set up video output
        final IVLCVout vout = mMediaPlayer.getVLCVout();
        vout.setVideoView(sfVideo);
        vout.addCallback(this);
        vout.attachViews();

        Media m = URLUtil.isValidUrl(videoLink) ? new Media(libvlc, Uri.parse(videoLink)) : new Media(libvlc, videoLink);
        mMediaPlayer.setMedia(m);
        mMediaPlayer.play();
    } catch (Exception e) {
        Logger.printInfo(TAG, "Error creating video player: ");
        e.printStackTrace();
        if (onPlayingFailedCallback != null) {
            onPlayingFailedCallback.operationFinished();
        }
    }
}
 
开发者ID:KKorvin,项目名称:uPods-android,代码行数:35,代码来源:FragmentVideoPlayer.java

示例2: onStart

import org.videolan.libvlc.IVLCVout; //导入方法依赖的package包/类
@Override
    protected void onStart() {
        super.onStart();

        final IVLCVout vlcVout = mMediaPlayer.getVLCVout();
//        final IVLCVout vlcVout2 = mMediaPlayer2.getVLCVout();
        vlcVout.setVideoView(mVideoSurface);
//        vlcVout2.setVideoView(mVideoSurface1);
        vlcVout.attachViews();
//        vlcVout2.attachViews();
        mMediaPlayer.getVLCVout().addCallback(this);
//        mMediaPlayer2.getVLCVout().addCallback(this);

        Media media = new Media(mLibVLC, Uri.parse(SAMPLE_URL));
//        Media media1 = new Media(mLibVLC, Uri.parse(SAMPLE_URL1));
        mMediaPlayer.setMedia(media);
//        mMediaPlayer2.setMedia(media1);
        media.release();
        mMediaPlayer.play();
//        mMediaPlayer2.play();
//        mMediaPlayer.setRate(.5f);

    }
 
开发者ID:m-damavandi,项目名称:Android-VLC-Sample,代码行数:24,代码来源:MainActivity.java

示例3: createPlayer

import org.videolan.libvlc.IVLCVout; //导入方法依赖的package包/类
private void createPlayer(String mediaUrl) {
    releasePlayer();

    if(mediaUrl.isEmpty()) return;

    try {

        // Create LibVLC
        mLibvlc = new LibVLC();

        // Create media player
        mMediaPlayer = new MediaPlayer(mLibvlc);

        final IVLCVout vout = mMediaPlayer.getVLCVout();

        vout.setVideoView(mSurfaceView);
        vout.addCallback(this);
        vout.attachViews();

        final Media media = new Media(mLibvlc, Uri.parse(mediaUrl));
        mMediaPlayer.setMedia(media);
        mMediaPlayer.setEventListener(listener);
        //media.release();
        if(mIsPlaying) {
            startPlayer();
        }
    } catch (Exception e) {
        Toast.makeText(this, "Error creating player!", Toast.LENGTH_LONG).show();
    }

}
 
开发者ID:d0pam1n,项目名称:DoorPhone,代码行数:32,代码来源:MainActivity.java

示例4: setMedia

import org.videolan.libvlc.IVLCVout; //导入方法依赖的package包/类
private void setMedia(Media media) {
  //delay = network buffer + file buffer
  //media.addOption(":network-caching=" + Constants.BUFFER);
  //media.addOption(":file-caching=" + Constants.BUFFER);
  media.addOption(":fullscreen");
  media.setHWDecoderEnabled(true, false);
  player = new MediaPlayer(vlcInstance);
  player.setMedia(media);
  player.setEventListener(this);

  IVLCVout vlcOut = player.getVLCVout();
  //set correct class for render depend of constructor called
  if (surfaceView != null) {
    vlcOut.setVideoView(surfaceView);
    width = surfaceView.getWidth();
    height = surfaceView.getHeight();
  } else if (textureView != null) {
    vlcOut.setVideoView(textureView);
    width = textureView.getWidth();
    height = textureView.getHeight();
  } else if (surfaceTexture != null) {
    vlcOut.setVideoSurface(surfaceTexture);
  } else if (surface != null) {
    vlcOut.setVideoSurface(surface, surfaceHolder);
  } else {
    throw new RuntimeException("You cant set a null render object");
  }
  if (width != 0 && height != 0) vlcOut.setWindowSize(width, height);
  vlcOut.attachViews();
  player.setVideoTrackEnabled(true);
  player.play();
}
 
开发者ID:pedroSG94,项目名称:vlc-example-streamplayer,代码行数:33,代码来源:VlcVideoLibrary.java

示例5: createPlayer

import org.videolan.libvlc.IVLCVout; //导入方法依赖的package包/类
/**
 * Creates MediaPlayer and plays video
 *
 * @param media
 */
private void createPlayer(String media) {
    releasePlayer();
    try {
        if (media.length() > 0) {
            Toast toast = Toast.makeText(this, media, Toast.LENGTH_LONG);
            toast.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0,
                    0);
            toast.show();
        }

        // Create LibVLC
        // TODO: make this more robust, and sync with audio demo
        ArrayList<String> options = new ArrayList<String>();
        //options.add("--subsdec-encoding <encoding>");
        options.add("--aout=opensles");
        options.add("--audio-time-stretch"); // time stretching
        options.add("-vvv"); // verbosity
        libvlc = new LibVLC(this, options);
        holder.setKeepScreenOn(true);

        // Creating media player
        mMediaPlayer = new MediaPlayer(libvlc);
        mMediaPlayer.setEventListener(mPlayerListener);

        // Seting up video output
        final IVLCVout vout = mMediaPlayer.getVLCVout();
        vout.setVideoView(mSurface);
        //vout.setSubtitlesView(mSurfaceSubtitles);
        vout.addCallback(this);
        vout.attachViews();

        Media m = new Media(libvlc, Uri.parse(media));
        mMediaPlayer.setMedia(m);
        mMediaPlayer.play();
    } catch (Exception e) {
        Toast.makeText(this, "Error in creating player!", Toast
                .LENGTH_LONG).show();
    }
}
 
开发者ID:Truiton,项目名称:RTMPPlayer,代码行数:45,代码来源:MainActivity.java

示例6: vlcSetSurface

import org.videolan.libvlc.IVLCVout; //导入方法依赖的package包/类
public void vlcSetSurface(Surface surface){
    // Set up video output
    final IVLCVout vout = mMediaPlayer.getVLCVout();
    vout.setVideoSurface(surface, null);
    //vout.setSubtitlesView(mSurfaceSubtitles);
    vout.addCallback(this);
    vout.attachViews();
}
 
开发者ID:ashqal,项目名称:MD-vlc-sample,代码行数:9,代码来源:VLCVideoActivity.java

示例7: onHostResume

import org.videolan.libvlc.IVLCVout; //导入方法依赖的package包/类
@Override
public void onHostResume() {
    if (mMediaPlayer != null) {
        IVLCVout vout = mMediaPlayer.getVLCVout();
        if (vout != null) {
            if (!vout.areViewsAttached()) {
                vout.setVideoView(this);
                vout.attachViews();
            }
        }
    }
}
 
开发者ID:Ivshti,项目名称:react-native-vlc,代码行数:13,代码来源:ReactVideoView.java

示例8: onStart

import org.videolan.libvlc.IVLCVout; //导入方法依赖的package包/类
@Override
public void onStart() {
    super.onStart();
    final IVLCVout vlcVout = mMediaPlayer.getVLCVout();
    vlcVout.setVideoView(mVideoSurface);
    vlcVout.attachViews();
    mMediaPlayer.getVLCVout().addCallback(this);
    Media media = new Media(mLibVLC, Uri.parse(SAMPLE_URL));
    
    mMediaPlayer.setMedia(media);
    media.release();
    mMediaPlayer.play();
}
 
开发者ID:m-damavandi,项目名称:Android-VLC-Sample,代码行数:14,代码来源:PlayerFragment.java

示例9: VlcMediaPlayer

import org.videolan.libvlc.IVLCVout; //导入方法依赖的package包/类
public VlcMediaPlayer(SurfaceView videoView, SurfaceView subtitlesView, List<String> libVlcOptions) {
    super(createLibVlc(libVlcOptions));
    LibVLC.setOnNativeCrashListener(nativeCrashListener);

    setMaxPlayRate(64); // TODO pref
    setEventListener(vlcEventListener);

    // video output
    final IVLCVout vout = getVLCVout();
    vout.setVideoView(videoView);
    if (subtitlesView != null)
        vout.setSubtitlesView(subtitlesView);
    vout.addCallback(nativeCallback);
    vout.attachViews();
}
 
开发者ID:oakesville,项目名称:mythling,代码行数:16,代码来源:VlcMediaPlayer.java

示例10: createPlayer

import org.videolan.libvlc.IVLCVout; //导入方法依赖的package包/类
/*************
     * Player
     *************/

    private void createPlayer(String media) {
        releasePlayer();
        setupControls();
        try {
            final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext());
            // Create LibVLC
            // TODO: make this more robust, and sync with audio demo
            ArrayList<String> options = new ArrayList<String>(50);
            int deblocking = getDeblocking(-1);

            int networkCaching = pref.getInt("network_caching_value", 0);
            if (networkCaching > 60000)
                networkCaching = 60000;
            else if (networkCaching < 0)
                networkCaching = 0;
            //options.add("--subsdec-encoding <encoding>");
              /* CPU intensive plugin, setting for slow devices */
            options.add("--audio-time-stretch");
            options.add("--avcodec-skiploopfilter");
            options.add("" + deblocking);
            options.add("--avcodec-skip-frame");
            options.add("0");
            options.add("--avcodec-skip-idct");
            options.add("0");
            options.add("--subsdec-encoding");
//            options.add(subtitlesEncoding);
            options.add("--stats");
        /* XXX: why can't the default be fine ? #7792 */
            if (networkCaching > 0)
                options.add("--network-caching=" + networkCaching);
            options.add("--androidwindow-chroma");
            options.add("RV32");

            options.add("-vv");

            libvlc = new LibVLC(options);

            holder.setKeepScreenOn(true);

            // Create media player
            mMediaPlayer = new MediaPlayer(libvlc);
            holder.setFormat(PixelFormat.RGBX_8888);
            holder.setKeepScreenOn(true);
            mMediaPlayer.setEventListener(mPlayerListener);

            // Set up video output
            final IVLCVout vout = mMediaPlayer.getVLCVout();
            if (!vout.areViewsAttached()) {
                vout.setVideoView(mSurface);
                vout.addCallback(this);
                vout.attachViews();
            }
            //vout.setSubtitlesView(mSurfaceSubtitles);
            Uri uri = Uri.parse(media);
            Media m = new Media(libvlc, uri);
            mMediaPlayer.setMedia(m);
            mMediaPlayer.play();
        } catch (Exception e) {
            Toast.makeText(this, "Error creating player!", Toast.LENGTH_LONG).show();
        }
    }
 
开发者ID:ghondar,项目名称:react-native-vlc-player,代码行数:66,代码来源:PlayerActivity.java

示例11: startPlayback

import org.videolan.libvlc.IVLCVout; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void startPlayback() {
    /* start playback only when audio service and both surfaces are ready */
    if (mPlaybackStarted || mService == null)
        return;

    LibVLC().setOnHardwareAccelerationError(this);
    final IVLCVout vlcVout = mService.getVLCVout();
    if (mPresentation == null) {
        vlcVout.setVideoView(mSurfaceView);
        if (mSubtitlesSurfaceView.getVisibility() != View.GONE)
            vlcVout.setSubtitlesView(mSubtitlesSurfaceView);
    } else {
        vlcVout.setVideoView(mPresentation.mSurfaceView);
        if (mSubtitlesSurfaceView.getVisibility() != View.GONE)
            vlcVout.setSubtitlesView(mPresentation.mSubtitlesSurfaceView);
    }
    vlcVout.addCallback(this);
    vlcVout.attachViews();

    mPlaybackStarted = true;

    if (AndroidUtil.isHoneycombOrLater()) {
        if (mOnLayoutChangeListener == null) {
            mOnLayoutChangeListener = new View.OnLayoutChangeListener() {
                private final Runnable mRunnable = new Runnable() {
                    @Override
                    public void run() {
                        changeSurfaceLayout();
                    }
                };
                @Override
                public void onLayoutChange(View v, int left, int top, int right,
                                           int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
                    if (left != oldLeft || top != oldTop || right != oldRight || bottom != oldBottom) {
                        /* changeSurfaceLayout need to be called after the layout changed */
                        mHandler.removeCallbacks(mRunnable);
                        mHandler.post(mRunnable);
                    }
                }
            };
        }
        mSurfaceFrame.addOnLayoutChangeListener(mOnLayoutChangeListener);
    }
    changeSurfaceLayout();

    if (mMediaRouter != null) {
        // Listen for changes to media routes.
        mediaRouterAddCallback(true);
    }

    loadMedia();

    mSurfaceView.setKeepScreenOn(true);

    // Add any selected subtitle file from the file picker
    if(mSubtitleSelectedFiles.size() > 0) {
        for(String file : mSubtitleSelectedFiles) {
            Log.i(TAG, "Adding user-selected subtitle " + file);
            mService.addSubtitleTrack(file);
        }
    }

    // Set user playback speed
    mService.setRate(mSettings.getFloat(PreferencesActivity.VIDEO_SPEED, 1));
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:67,代码来源:VideoPlayerActivity.java


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