TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Smile
1.5k
198
36.5k
Video getting paused on timer and update panel on timer tick
Feb 1 2018 3:48 AM
In an asp page i am displaying both image as well as vidoe.For displaying image i am using image asp control for video i have embbed media player.I am displaying images from a local folder in time basis using timer. on timer tick event video is getting paused/halt till the image is getting updated.
aspx code
<
style
type
=
"text/css"
>
#form1 {
.floatleft
{
float: left;
margin: 0 0 10px 10px;
border: 1px solid #666;
padding: 2px;
}
.floatright
{
float: right;
margin: 0 0 10px 10px;
border: 1px solid #666;
padding: 2px;
}
</
style
>
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:Button
ID
=
"btnCreateXML"
runat
=
"server"
Text
=
"CreateXMLTwofiles"
OnClick
=
"btnCreateXML_Click"
/>
<
asp:Button
ID
=
"btnCreateXMLSingleFile"
runat
=
"server"
Text
=
"CreateXMLSingleFile"
OnClick
=
"btnCreateXMLSingleFile_Click"
/>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
>
</
asp:ScriptManager
>
<
asp:Button
ID
=
"btnDisp"
runat
=
"server"
Text
=
"Download"
OnClick
=
"btnDisp_Click"
Visible
=
"false"
/>
<
asp:Button
ID
=
"btnStartDisp"
runat
=
"server"
Text
=
"Display"
OnClick
=
"btnStartDisp_Click"
Visible
=
"false"
/>
<
asp:Button
ID
=
"btnTestXml"
runat
=
"server"
Text
=
"Display Single File"
OnClick
=
"btnTestXml_Click"
/>
<
asp:UpdatePanel
ID
=
"BannerPanel"
runat
=
"server"
UpdateMode
=
"Always"
>
<
ContentTemplate
>
<
asp:Timer
ID
=
"Timer1"
runat
=
"server"
OnTick
=
"Timer1_Tick"
Interval
=
"5000"
Enabled
=
"false"
>
</
asp:Timer
>
<
asp:Button
ID
=
"btnReadXml"
runat
=
"server"
Text
=
"Display from FTP"
OnClick
=
"btnReadXml_Click"
/>
<
asp:Panel
ID
=
"Panel1"
runat
=
"server"
Height
=
"370px"
Width
=
"428px"
CssClass
=
"floatleft"
>
<
asp:Image
ID
=
"Image1"
runat
=
"server"
Height
=
"360px"
Width
=
"425px"
/>
</
asp:Panel
>
</
ContentTemplate
>
</
asp:UpdatePanel
>
<
embed
id
=
'embed1'
runat
=
"server"
name
=
'mediaPlayer'
type
=
'application/x-mplayer2'
pluginspage
=
'http://microsoft.com/windows/mediaplayer/en/download/'
displaysize
=
'4'
autosize
=
'-1'
bgcolor
=
'darkblue'
showcontrols
=
'false'
showtracker
=
'-1'
showdisplay
=
'0'
showstatusbar
=
'-1'
videoborder3d
=
'-1'
width
=
'500'
designtimesp
=
'5311'
loop
=
'true'
style
=
"position:absolute; top: 76px; left: 446px; height: 363px;"
/>
</
form
>
code behind
protected
void
Timer1_Tick(
object
sender, EventArgs e)
{
try
{
DispImagesDataset();
}
catch
(Exception)
{
throw
;
}
}
private
void
DispImagesDataset()
{
try
{
IndexTmr = Convert.ToInt16(Session[
"tmrindex"
]);
DataSet Ds = Session[
"ImageDataset"
]
as
DataSet;
if
(IndexTmr <= Ds.Tables[0].Rows.Count - 1)
{
string
Filename = Ds.Tables[0].Rows[IndexTmr][
"ImageName"
].ToString();
int
seq = Convert.ToInt16(Ds.Tables[0].Rows[IndexTmr][
"SeqNo"
]);
int
DispTime = Convert.ToInt16(Ds.Tables[0].Rows[IndexTmr][
"DisplayTimeout"
]);
string
ext = Path.GetExtension(Filename);
string
localstr = Server.MapPath(
"~//bin//Images//"
+ Filename);
Byte[] bytes = File.ReadAllBytes(localstr);
string
base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
Image1.ImageUrl =
"data:image/"
+ ext +
";base64,"
+ base64String;
Image1.Visible =
true
;
Timer1.Interval = DispTime * 1000;
IndexTmr = IndexTmr + 1;
Session[
"tmrindex"
] = IndexTmr;
}
else
{
IndexTmr = 0;
Session[
"tmrindex"
] = IndexTmr;
}
}
catch
(Exception ex)
{
throw
;
}
}
for pasiing the playlist to media player
string
urlstr = Server.MapPath(
"~/bin"
) +
"\\Images\\Playlist1.wpl"
;
embed1.Attributes.Add(
"src"
, urlstr);
Any suggestion
thanxs in advance
Reply
Answers (
0
)
convert List<dynamic> items to Datatable
Get data of clipboard into textbox on button click in chrome