简体   繁体   中英

Blank screen on video expand in android

I created a sample app using JieCao player for android and it works perfectly fine both on portrait and landscape mode (on pressing expand button). But when I tried to integrate the same for the another app that I'm creating I get a black screen on pressing the video expand button but the audio is playing in the background. Couldn't get the reason why this is happening !! I have explained the code that I'm working on below :

Mainactivity.java

jcVideoPlayerStandard = (JCVideoPlayerStandard) findViewById(R.id.custom_videoplayer_standard);
jcVideoPlayerStandard.setUp("http://2449.vod.myqcloud.com/2449_bfbbfa3cea8f11e5aac3db03cda99974.f20.mp4","");
ImageLoader.getInstance().displayImage("http://p.qpic.cn/videoyun/0/2449_bfbbfa3cea8f11e5aac3db03cda99974_1/640",jcVideoPlayerStandard.thumbImageView);

activity_main.xml

  <fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard
            android:id="@+id/custom_videoplayer_standard"
            android:layout_width="match_parent"
            android:layout_marginTop="55dp"
            android:layout_height="250dp" />

And a separate java file that I include in AndroidManifest file though I'm pretty much sure it has nothing to do with the error. Here is the code :

public class VideoApplication extends Application {

@Override
public void onCreate() {
    super.onCreate();
    LeakCanary.install(this);
    initUniversalImageLoader();
}

private void initUniversalImageLoader() {
    ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(getApplicationContext());
    config.threadPriority(Thread.NORM_PRIORITY - 2);
    config.denyCacheImageMultipleSizesInMemory();
    config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
    config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
    config.tasksProcessingOrder(QueueProcessingType.LIFO);
    config.writeDebugLogs(); // Remove for releaseAllVideos app
    config.defaultDisplayImageOptions(getDefaultDisplayImageOption());
    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config.build());
}

public static DisplayImageOptions getDefaultDisplayImageOption() {
    DisplayImageOptions options = new DisplayImageOptions.Builder()
            .showImageOnLoading(new ColorDrawable(Color.parseColor("#f0f0f0")))
            .resetViewBeforeLoading(true)
            .cacheInMemory(true)
            .cacheOnDisk(true)
            .considerExifParams(true)
            .imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .displayer(new FadeInBitmapDisplayer(500)) 
            .build();
    return options;
}}

If there is anything else needed please let me know, I just want to know where I am going wrong.

Note : People with higher reputation please create a tag "JieCao-player" which might be useful while creating a question related to this category. As I don't have enough reputation, kindly do the needful.

Just need to make sure that "android:hardwareAccelerated" is set to true in all the activities in Manifest file. By doing so the problem got resolved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM