简体   繁体   English

视频的黑屏在android中展开

[英]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). 我使用用于Android的JieCao播放器创建了一个示例应用程序,它在纵向和横向模式下(按扩展按钮)都可以完美运行。 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 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 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. 和一个我包含在AndroidManifest文件中的单独的Java文件,尽管我非常确定它与错误无关。 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. 注意 :具有较高声誉的人请创建一个标签“ JieCao-player”,该标签在创建与此类别相关的问题时可能会很有用。 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. 只需确保在清单文件中的所有活动中将“ android:hardwareAccelerated”设置为true。 By doing so the problem got resolved. 通过这样做,问题得以解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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