drawRect / Instagram_Stories

Inspired by Instagram Stories functionality. This source is similar to Instagram Stories, which is having both image and video support.
MIT License
414 stars 76 forks source link

duplicate progress bar issue #120

Open forTJ555 opened 3 years ago

forTJ555 commented 3 years ago

Hi @ranmyfriend @boominadhaprakash i facing duplicate progress bar issue when start story from particular snap below are some change that i did

in cellForItemAt i have change these thing

 nStoryIndex = indexPath.item
 pickedStoryIndex = story?.lastPlayedSnapIndex ?? 0

lastPlayedSnapIndex we are storing at backend

and in willDisplay method did below changes

 if story_copy == nil {
            let s = stories.stories[nStoryIndex+handPickedStoryIndex]
            cell.willDisplayCellForZerothIndex(with: s.lastPlayedSnapIndex ?? 0)
            return
        }
        if indexPath.item == nStoryIndex {

            let s = stories.stories[nStoryIndex+handPickedStoryIndex]
            cell.willDisplayCell(with: s.lastPlayedSnapIndex ?? 0)
        }

pls let me if did anything wrong. the duplicate progress is not shown randomly i am not to reproduce it with particular scenario ![Uploading Simulator Screen Shot - iPhone 11 - 2021-01-06 at 19.03.27.png…]()

forTJ555 commented 3 years ago

Simulator Screen Shot - iPhone 11 - 2021-01-06 at 19 03 27

boominadhapm commented 3 years ago

Hi @forTJ555

We will check and let you know. Are you using our latest master branch source code?

forTJ555 commented 3 years ago

Hi @boominadhaprakash , no i haven't use the latest code, because i did many changes in at my end. if you can mention which classes of library you update that can prevent this issue then it would be great help and i'll change only those

boominadhapm commented 3 years ago

Hi @forTJ555 Please take latest source folder from Master and apply your changes on that. Because we have done so many bug fixes and improvements in almost all files.

Even after updating to latest code, if you face any issues let us know.

forTJ555 commented 3 years ago

okay thanks i'll do and let you know if there is still any issue. and pls confirm am i follow right approach to start story from particular snap with upper mentioned code? @boominadhaprakash

boominadhapm commented 3 years ago

Hi @forTJ555

Please refer this issue #109

You will get to know, how to start story from particular snap.

albertoramonj commented 3 years ago

I was able to reproduce it. When is transitioning, for example, from an image to a video type (always to a video), you have to long-press just at the moment of the change. Then when you release the press, the video animation seems to end as finished and then starts playing again both video and next snap (don’t know if could be due a concurrency problem or a strange behavior of the UIVIew.animation that finishes as completed although is not).

After hours of testing, I found a workaround: simply cancel the gestures before start playing the video the first time:

IGStoryPreviewCell.swift

private func startPlayer(videoView: IGPlayerView, with url: String) {
        longPress_gesture.isEnabled = false
        tap_gesture.isEnabled = false
        longPress_gesture.isEnabled = true
        tap_gesture.isEnabled = true

        […]

Hope it helps. And thanks for this great work.

boominadhaprakash commented 3 years ago

Hi @albertoramonj

Thanks for spending time and reproduced this issue. It's glad that you found workaround for this bug.

Definitely this will help for other people who will face this same issue.

faisyleo commented 5 months ago

Hello Guys,

Am facing still multiple progress bar loading at a same time issue.

Scenario is that, first time when I add custom data for load stories then Second number story at index 0 & 1 load at a same time.

I attached the json file & video of stories.json kindly check it.

stories.json

Uploading 3a2eac83-d340-431d-b641-59afc4e9fea5.mp4…