Java Code Examples for tv.danmaku.ijk.media.player.IjkMediaPlayer#native_profileBegin()

The following examples show how to use tv.danmaku.ijk.media.player.IjkMediaPlayer#native_profileBegin() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IjkVideoView.java    From DMusic with Apache License 2.0 6 votes vote down vote up
private void init(Context context) {
    this.mActivity = (Activity) context;
    // init player
    try {
        IjkMediaPlayer.loadLibrariesOnce(null);
        IjkMediaPlayer.native_profileBegin("libijkplayer.so");
        playerSupport = true;
    } catch (Throwable e) {
        ULog.e("GiraffePlayer loadLibraries error" + e);
    }

    initBackground();
    setFocusable(true);
    setFocusableInTouchMode(true);
    requestFocus();
}
 
Example 2
Source File: DragVideoActivity.java    From MVideo with Apache License 2.0 6 votes vote down vote up
@Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_drag_video);
        screenWidth = getResources().getDisplayMetrics().widthPixels;
        screenHeight = getResources().getDisplayMetrics().heightPixels;
        previewImage = (ImageView) findViewById(R.id.previewImage);
        dragVideoView = (DragVideoView) findViewById(R.id.dragVideoView);
        mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
        IjkMediaPlayer.loadLibrariesOnce(null);
        IjkMediaPlayer.native_profileBegin("libijkplayer.so");
        getIntentData();
        mProgressBar.getIndeterminateDrawable().setColorFilter(
                progressColor, PorterDuff.Mode.MULTIPLY);
        if (!TextUtils.isEmpty(imagePath)) {
//            Glide.with(DragVideoActivity.this).load(imagePath).into(previewImage);
            loader.bind(previewImage, imagePath);
        }
        setViewPosition();
    }
 
Example 3
Source File: LiveVideoActivity.java    From AndroidTvDemo with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_live_video);
    initTiemData();
    initVideoList();
    mSettings = new Settings(this);
    
    // handle arguments
    mVideoPath = getIntent().getStringExtra("videoPath");
    playIndex = getIntent().getIntExtra("index", 0);
    mVideoPath = urls[playIndex];
    Intent intent = getIntent();
    String intentAction = intent.getAction();
    if (!TextUtils.isEmpty(mVideoPath))
    {
        new RecentMediaStorage(this).saveUrlAsync(mVideoPath);
    }
    
    // init player
    IjkMediaPlayer.loadLibrariesOnce(null);
    IjkMediaPlayer.native_profileBegin("libijkplayer.so");
    tips = (TextView)findViewById(R.id.tips);
    liveName = (TextView)findViewById(R.id.liveName);
    mVideoView = (IjkVideoView)findViewById(R.id.video_view);
    playVideo(mVideoPath, playIndex);
}
 
Example 4
Source File: ParsingPlayer.java    From ParsingPlayer with GNU Lesser General Public License v2.1 5 votes vote down vote up
private IjkMediaPlayer createPlayer(Config config) {
    IjkMediaPlayer ijkMediaPlayer = new IjkMediaPlayer();
    IjkMediaPlayer.loadLibrariesOnce(null);
    IjkMediaPlayer.native_profileBegin("libijkplayer.so");
    IjkMediaPlayer.native_setLogLevel(BuildConfig.DEBUG ? IjkMediaPlayer.IJK_LOG_DEFAULT : IjkMediaPlayer.IJK_LOG_ERROR);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT,
            "safe", config.safe ? 1 : 0);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT,
            "protocol_whitelist", config.whiteList);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
            "mediacodec-auto-rotate", config.mediacodecAutoRotate ? 1 : 0);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
            "mediacodec-handle-resolution-change", config.mediacodecHandleResolutionChange ? 1 : 0);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
            "opensles", config.opensles ? 1 : 0);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
            "overlay-format", config.overLayFormat);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
            "framedrop", config.frameDrop ? 1 : 0);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
            "start-on-prepared", config.startOnPrepared ? 1 : 0);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT,
            "http-detect-range-support", config.httpRangeSupport ? 1 : 0);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_CODEC,
            "skip_loop_filter", config.skipLoopFilter);
    return ijkMediaPlayer;
}
 
Example 5
Source File: GiraffePlayer.java    From IjkPlayerDemo with Apache License 2.0 5 votes vote down vote up
public GiraffePlayer(
        final Activity activity,
        final LinearLayout containerView,
        final String url
) {
    IjkMediaPlayer.loadLibrariesOnce(null);
    IjkMediaPlayer.native_profileBegin("libijkplayer.so");
    this.activity=activity;
    this.containerView = containerView;
    this.view = LayoutInflater.from(activity).inflate(R.layout.giraffe_player,containerView,false);
    containerView.addView(view);
    commonInit(url);
}
 
Example 6
Source File: GiraffePlayer.java    From IjkPlayerDemo with Apache License 2.0 5 votes vote down vote up
public GiraffePlayer(
        final Activity activity,
        final LinearLayout containerView,
        final RelativeLayout fullContainerView,
        final String url
) {
    IjkMediaPlayer.loadLibrariesOnce(null);
    IjkMediaPlayer.native_profileBegin("libijkplayer.so");
    this.activity=activity;
    this.containerView = containerView;
    this.fullContainerView = fullContainerView;
    this.view = LayoutInflater.from(activity).inflate(R.layout.giraffe_player,containerView,false);
    containerView.addView(view);
    commonInit(url);
}
 
Example 7
Source File: FullScreenVideoActivity.java    From AndroidTvDemo with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_player);
    
    mSettings = new Settings(this);
    
    // handle arguments
    mVideoPath = getIntent().getStringExtra("videoPath");
    
    Intent intent = getIntent();
    String intentAction = intent.getAction();
    if (!TextUtils.isEmpty(intentAction))
    {
        if (intentAction.equals(Intent.ACTION_VIEW))
        {
            mVideoPath = intent.getDataString();
        }
        else if (intentAction.equals(Intent.ACTION_SEND))
        {
            mVideoUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH)
            {
                String scheme = mVideoUri.getScheme();
                if (TextUtils.isEmpty(scheme))
                {
                    Log.e(TAG, "Null unknown ccheme\n");
                    finish();
                    return;
                }
                if (scheme.equals(ContentResolver.SCHEME_ANDROID_RESOURCE))
                {
                    mVideoPath = mVideoUri.getPath();
                }
                else if (scheme.equals(ContentResolver.SCHEME_CONTENT))
                {
                    Log.e(TAG, "Can not resolve content below Android-ICS\n");
                    finish();
                    return;
                }
                else
                {
                    Log.e(TAG, "Unknown scheme " + scheme + "\n");
                    finish();
                    return;
                }
            }
        }
    }
    
    if (!TextUtils.isEmpty(mVideoPath))
    {
        new RecentMediaStorage(this).saveUrlAsync(mVideoPath);
    }
    
    // init UI
    Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    
    ActionBar actionBar = getSupportActionBar();
    customMediaController = new CustomMediaController(this, false);
    customMediaController.setSupportActionBar(actionBar);
    actionBar.setDisplayHomeAsUpEnabled(true);
    
    mToastTextView = (TextView)findViewById(R.id.toast_text_view);
    mHudView = (TableLayout)findViewById(R.id.hud_view);
    mDrawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
    mRightDrawer = (ViewGroup)findViewById(R.id.right_drawer);
    
    mDrawerLayout.setScrimColor(Color.TRANSPARENT);
    
    // init player
    IjkMediaPlayer.loadLibrariesOnce(null);
    IjkMediaPlayer.native_profileBegin("libijkplayer.so");
    
    mVideoView = (IjkVideoView)findViewById(R.id.video_view);
    mVideoView.setMediaController(customMediaController);
    mVideoView.setHudView(mHudView);
    // prefer mVideoPath
    if (mVideoPath != null)
        mVideoView.setVideoPath(mVideoPath);
    else if (mVideoUri != null)
        mVideoView.setVideoURI(mVideoUri);
    else
    {
        Log.e(TAG, "Null Data Source\n");
        finish();
        return;
    }
    mVideoView.start();
}