Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to add image and story in storyview. #23

Open
shuprajain opened this issue May 29, 2019 · 0 comments
Open

how to add image and story in storyview. #23

shuprajain opened this issue May 29, 2019 · 0 comments

Comments

@shuprajain
Copy link

hi i am getting image and video in same string array and i want to split image and video by their extension and playing both in same story view

resources = new String[PostStory.length()];
for (int j = 0; j < PostStory.length(); j++) {

                        JSONObject object = PostStory.getJSONObject(j);
                        getpostimage = object.getString("post_images");
                        AllStoryStatusModel allStoryStatusModel = new AllStoryStatusModel();
                        allStoryStatusModel.setImage_viedeo(object.getString("post_images"));
                        allStoryStatusModel.setUser_id(object.getString("user_id"));
                        datalist.add(allStoryStatusModel);

                        resources[j] = getpostimage;

// extention = MimeTypeMap.getFileExtensionFromUrl(getpostimage);
// if (extention.equals("mp4")){
// resources[j] = getpostimage;
//
// image.setVisibility(View.GONE);
//
// }else{
// videoview.setVisibility(View.GONE);
// image.setVisibility(View.VISIBLE);
// resources[j] = getpostimage;
//
// }
}

                    if (resources[counter].endsWith("mp4")){
                        videoview.setVisibility(View.VISIBLE);
                        videoview.setVideoURI(Uri.parse(resources[counter]));
                        videoview.start();
                    }else{
                        Picasso.with(AllStatusStoryActivity.this)
                                .load(resources[counter])
                                .skipMemoryCache()
                                .into(image);
                    }

@OverRide
public void onNext() {
S.E("data Mp4111" + resources[++counter]);
if (resources[++counter].endsWith("mp4")){
videoview.setVisibility(View.VISIBLE);
videoview.setVideoURI(Uri.parse(resources[++counter]));
videoview.start();
}else{
Picasso.with(AllStatusStoryActivity.this)
.load(resources[++counter])
.skipMemoryCache()
.into(image);
}

// videoview.setVisibility(View.VISIBLE);
// videoview.setVideoURI(Uri.parse(resources[++counter]));
// videoview.start();
}

@Override
public void onPrev() {
    if ((counter - 1) < 0) return;
    S.E("data jpg222" + resources[--counter]);
    if (resources[--counter].endsWith("mp4")){
        videoview.setVisibility(View.VISIBLE);
        videoview.setVideoURI(Uri.parse(resources[--counter]));
        videoview.start();
    }else{
        Picasso.with(AllStatusStoryActivity.this)
                .load(resources[--counter])
                .skipMemoryCache()
                .into(image);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant