I implemented progress bar to show completing status to users when video processes in background. it works well on single instance. but mixed it up when two concurrent video process started.
When two video processes initiated by two different users at same time, both users will see mixed progress status sometimes from video process 1, sometimes from another.
Video process on server side initiated with static variable.
public static MediaHandler _mhandler = new MediaHandler();
Progress indication sent to page via
[WebMethod]
public static string GetProgressStatus()
{
return Math.Round(_mhandler.vinfo.ProcessingCompleted, 2).ToString();
}
Progress request sent by progress bar after every few seconds.
Now my question is how i can set mediahandler object which can target only one instance at a time.
e.g progress bar 01 shows status of video process 01 only
and
progress bar 02 shows status of video process 02 only
Thanks for sharing ideas but unfortunately no solution solve issue of concurrency in case of using static objects which is almost shared across all users. Now i made some adjustments which solved my problem.
Instead of using single static object, i used generic list object to stored all concurrent process objects in a list. Here is code.
Where MediaHandler is class name responsible for processing videos.
The following function is responsible for initiating video processing
Now with each progress bar request process id must be sent to function in order to send progress status of proper video processing object.
Once processing completed 100% just store all video information in object and remove media handler object from static concurrent list.
In this way unlimited number of concurrent processes and progress bar requests made possible.