Problems in embedding VLC media player in asp.net page - asp.net

I am trying to add or embed VLC media player into my asp.net web page.
the error I am getting is that object tag must contain a class,classid or progid attribute but I don't know how to get the values for those attributes.
Please help and be free to suggest any other way if possible for any media player that can run MP4 videos.I have
written the following code in the design
<div>
<object type="application/x-vlc-plugin" pluginspage="http://www.videolan.org"
autoplay="yes" lop="no" runat="server" ID="video"
style="width: 452px; height: 278px" />
<object classid="clsid:9BE31822-FDAD-461B-D51-BE1D1C159921" codebase="http://download.videolan.org/pub/videolan/vlc/last/win32/axvlc.cab"
height="28"></object>
</div>
<div><asp:Button ID="button_play" runat="server" Text="Play" on click="button_play_Click"/>
</div>
the error I am getting is that object tag must contain a class,classid or progid attribute but I don't know how to get the values for those attributes.Please help and be free to suggest any other way if possible for any media player that can run MP4 videos.

Related

Embed Image to aspx page from code behind

I'm programmatically (server-side) creating an Image object after my user chooses some value from a combonox.
I want to embed this image back into the aspx page at runtime, without saving it to disk or database.
So how can I do this? I tried to use memory stream, and send the image with response object, but than I only saw the image - it had overwritten the entire page.
Thanks...
Create the Handler and request it via:
<img src="Image.ashx?ID=myImageId" alt="text here"/>
<asp:Image runat="server" ImageUrl="~/Image.ashx?ID=myImageId" />
You could base64 encode the data and write it to the image data.
Like this:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot">
For this you will have to render the img tag yourself.
This way you don't have to write your image to a file on the server. It is sent from memory directly to the client browser.
Refer: Data URI schemes
Note this does not work with IE6.
Do something like this
<img src="yourimagegeneratingpage.aspx?query=value" />
When this image will be loaded it will generate a request to your page (yourimagegeneratingpage.aspx) and that page would respond with the image which will be shown by this img control.

Logo not appearing on some pages in ASP.net webforms title

ill try my best to explain this..
in the site.master I have added a logo to the title like so.
<div class="title">
<img alt="" class="style1" src="Images/logo.png" />
</div>
the logo shows up fine in all pages accept when the url is part of the account.
for example..
"http://localhost:54341/Sitename/mypage.aspx" (shows fine)
however
"http://localhost:54341/Sitename/Account/Register.aspx" (doesnt show)
im guessing its because it is in a parent folder (the images file).
Is there a better way?
EDIT: Images folder is at the top level
thanks in advance
Try using relative path with respect to root of the application:
<img alt="" class="style1" runat="server" src="~/Images/logo.png" />
Explaination:
ASP.NET includes the Web application root operator (~), which you can use when specifying a path in server controls. ASP.NET resolves the ~ operator to the root of the current application. You can use the ~ operator in conjunction with folders to specify a path that is based on the current root.
The following example shows the ~ operator used to specify a root-relative path for an image when using the Image server control In this example, the image file is read from the Images folder that is located directly under the root of the Web application, regardless of where in the Web site the page is located.
<asp:image runat="server" id="Image1"
ImageUrl="~/Images/SampleImage.jpg" />
You can use the ~ operator in any path-related property in server controls. The ~ operator is recognized only for server controls and in server code. You cannot use the ~ operator for client elements.
This should do it...
<img alt="" class="style1" src="<%=ResolveClientUrl("~/Images/logo.png")%>" />
#Kevin Main suggested : You need to put runat="server" on the image for this to work.. this worked a treat
This will work for localhost:54341/Sitename/Account/Register.aspx
<img alt="" class="style1" src="../Images/logo.png" />

FCKEditor and ASP.NET CSS

I've got an ASP.NET webforms project, and I want the fckeditor to use the stylesheet of the site so that people without HTML knowledge can look at the site and make changes.
Here is my current code:
<fckeditorv2:FCKeditor runat="server" ID="txtPageContent" Height="600" BasePath="~/FCKeditor/" ForceSimpleAmpersand="false" FormatOutput="false" EditorAreaCSS="../App_Themes/Professional/master.css"></fckeditorv2:FCKeditor>
As you can see, I've set the EditorAreaCSS property but it still doesn't put up the styles.
Instead of the ../App_Themes I've tried ~/App_Themes and /App_Themes but nothing.
The stylesheet certainly exists, and I've tried setting this in both the code behind and in the ASPX file.
When looking at the source, I get this in the hidden field that fckeditor makes:
<input type="hidden" id="ctl00_contentMain_txtPageContent___Config" value="ForceSimpleAmpersand=false&EditorAreaCSS=../App_Themes/Professional/main.css&FormatOutput=false&HtmlEncodeOutput=true" /><iframe id="ctl00_contentMain_txtPageContent___Frame" src="/eJs.Web/FCKeditor/editor/fckeditor.html?InstanceName=ctl00_contentMain_txtPageContent&Toolbar=Default" width="100%" height="600px" frameborder="no" scrolling="no">
Any ideas would be most appreciated.
I hope this will help. Probably best would be set it from code behind
EditorAreaCSS = this.ResolveUrl("~/App_Themes/Professional/main.css")
ResolveUrl() method is Page method, actually any System.Web.UI.Control should have it

.swf will play in IE but not Chrome

I have a asp.net 3.5 page that shows a file with a .swf extension. In IE when the page is pulled up the flash file is played and all looks normal. When I look at it in Google Chrome their is just a white space where the file should be playing. Is their a way to make the file play when viewing in chrome?
Here is the code:
<object width="400" height="250">
<param name="movie" value="abc.swf">
<embed src="../StaticPages/abc.swf" width="400" height="250" />
</object>
IE 7-9 will play as long as the param value is a valid path; but Chrome and other compliant browsers require both param and embed paths to be correct.
The page that is showing the flash file is being loaded by a text file that has the text for the page and the tags in it to run the flash file.
Once I looked at the tags more I see where the issue was. the src and value path were not the same so chrome could not locate the file. When I updated the file locations to match it worked.
Thanks
Original Code
<object width="400" height="250">
<param name="movie" value="abc.swf">
<embed src="../StaticPages/abc.swf" width="400" height="250" />
Fixed/correct Code:
<object width="400" height="250">
<param name="movie" value="/StaticPages/abc.swf">
<embed src="/StaticPages/abc.swf" width="400" height="250" />
This is most likely to be related to way you embed your swf into your page.
Especially if it also occurs in other browsers like firefox.
You can use SWFObject for this. It is an open source javascript library that handles embedding swfs in all different browsers.
More information on why this occurs: http://livedocs.adobe.com/flex/3/html/help.html?content=wrapper_13.html
Or if you want a more fancy way to display video content on a browser, try
http://flowplayer.org/demos/installation/index.html
and
http://www.longtailvideo.com/players/jw-flv-player/
Could you provide the actual tags / javascript you are using to place the flash file in the page?
Have you tried opening the swf file by itself in chrome to make sure it is not just a tag issue?
As DennisJaamann points out, at least as far as firefox, there are issues with tags. Firefox won't play swfs using just the object tag without specifying the proper type.
The problem of the difference in browsers is such that if you poke at the Adobe site itself, you'll see they use a public library for embedding swfs on their own site.

Working with images in asp.net MVC ViewMasterPage in design mode

While designing a master page i am adding a number of images to it.
I have an image tag inside the master page,
<img src="../../Content/Images/img19.jpg" class="profileImage" />
When i run my app, the image doesn't show up in the browser because the src path in the page that browser gets is same as in the master page.
ie. "../../Content/Images/img19.jpg"
But it should have been "Content/Images/img19.jpg"
If i correct the src path in master page as
<img src="Content/Images/img19.jpg" class="profileImage" />
Then I can see the image in the browser but not in design mode.
Any help is appreciated.
Use Asp Images
<asp:Image ID="Image1" runat="server" ImageUrl="~/Content/Pictures/xxx.png" />
You will see images in design mode and when you publish Pages too.
It should work fine if you use a leading slash:
<img src="/Content/Images/img19.jpg" class="profileImage" />
For other situations, you can convert a virtual (relative) path to an application absolute path using Url.Convert, such as
Url.Content("~/Content/Images/img19.jpg");

Resources