how to add image and story in storyview.
shuprajain opened this issue · comments
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);
}
}