如何在android jiecao视频播放器

时间:2017-08-08 07:57:33

标签: java android

我是Android开发的初学者。我想为我的视频播放器添加缩略图。我在我的Android应用程序中使用Android jiecao视频播放器。有了这个播放器,我想为jiecao播放器的起始屏幕添加一个可绘制的图像。但是没有方法可以将缩略图添加为android可绘制图像。请善意帮助我这样做。请欣赏任何正确的答案。这是我的代码:

activity_main.xml中

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:padding="10dp">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fillViewport="true">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">


                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />


                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello world"
                    android:textAppearance="?android:attr/textAppearanceLarge" />




            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard
                    android:id="@+id/videoplayer"
                    android:layout_width="match_parent"
                    android:layout_height="200dp" />


            </LinearLayout>


        </LinearLayout>

    </ScrollView>
</LinearLayout>

MainActivity.java

package com.example.theace.bestvedioplayer;

import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;

import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer;
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard;

public class MainActivity extends AppCompatActivity {

    private JCVideoPlayerStandard jcVideoPlayerStandard;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initUi();
    }

    public void initUi(){




        jcVideoPlayerStandard = (JCVideoPlayerStandard) findViewById(R.id.videoplayer);
        jcVideoPlayerStandard.setUp("http://2449.vod.myqcloud.com/2449_22ca37a6ea9011e5acaaf51d105342e3.f20.mp4", JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "");

    }

    @Override
    public void onBackPressed() {
        if (JCVideoPlayer.backPress()) {
            return;
        }
        super.onBackPressed();
    }
    @Override
    protected void onPause() {
        super.onPause();
        JCVideoPlayer.releaseAllVideos();
    }
}

0 个答案:

没有答案