• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 440
  • Last Modified:

How do you play a Flash file in ASP.net?

I am trying to play a Flash video that has an mp4 source in an ASP.net page without running into that ActiveX problem that stops you from running anything until you click the top of the page to accept the ActiveX control.  Is there a way I can embed the code in ASP.net/HTML without any Javascript?  I got the video to work on it's own but I need it to work with my web page.  Thanks!
0
VBBRett
Asked:
VBBRett
  • 17
  • 17
1 Solution
 
aibusinesssolutionsCommented:
As I mentioned in the other question, all you need to do is use the SWFObject, or Flash Object, which bypasses the activeX popup.
0
 
aibusinesssolutionsCommented:
Here is an example: http://blog.deconcept.com/swfobject/swfobject.html

Notice there is no active X pop up.
0
 
VBBRettAuthor Commented:
Would you be able to spell out the code that I should add to my html file or asp.net file?
0
Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

 
aibusinesssolutionsCommented:
Sure.
<html>
  <head>
     <script type="text/javascript" src="swfobject.js"></script>
  </head>
  
  <body>
    <div id="flashcontent"></div>
 
    <script type="text/javascript">
	var so = new SWFObject("MyFlashMovie.swf", "MyFlash", "300", "300", "9", "#FFFFFF");
        so.write("flashcontent");
    </script>
 
  </body>
</html>

Open in new window

0
 
aibusinesssolutionsCommented:
You can download the swfobject.js from here.  Just save it in the same folder as your html pages.

http://blog.deconcept.com/swfobject/swfobject.js
0
 
VBBRettAuthor Commented:
Here is a picture of what comes out after I run the page.
flashnotworking.jpg
0
 
VBBRettAuthor Commented:
Here is the code that I put into the asp.net/html file:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="MCSlick._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<script type="text/javascript" src="js/swfobject_source.js"></script>
    <title></title>
</head>
<body style="background-color:Black;">
    <form id="form1" runat="server">
    <div id="flashcontent"></div>
 
    <script type="text/javascript">
        var so = new SWFObject("mcslickvideoplayer4.swf", "mcslickvideoplayer4", "720", "480", "9", "#FFFFFF");
        so.write("flashcontent");
    </script>

    </form>
</body>
</html>
0
 
VBBRettAuthor Commented:
It is not finding the SWFObject.  The SWFObject is undefined.
0
 
aibusinesssolutionsCommented:
That should be js/swfobject.js

Not swfobject_source

Download swfobject.js from here: http://blog.deconcept.com/swfobject/swfobject.js

Just right click Save As to your JS folder.
0
 
VBBRettAuthor Commented:
OK, the error I got was "Object doesn't support this action".  What does that mean?
0
 
aibusinesssolutionsCommented:
can you paste your html?
0
 
VBBRettAuthor Commented:
Sure.  I will paste my html on my new html page that I am testing it with.
0
 
VBBRettAuthor Commented:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <title></title>
     <script type="text/javascript" src="js/swfobject.js"></script>
  </head>
 
  <body>
    <div id="flashcontent"></div>
 
    <script type="text/javascript">      
      var so = new swfobject("mcslickvideoplayer4.swf", "MyFlash", "300", "300", "9", "#FFFFFF");
      so.write("flashcontent");
       
    </script>
 
  </body>
</html>
0
 
aibusinesssolutionsCommented:
JavaScript is Case Sensitive. So it doesn't know what swfobject is.

<script type="text/javascript">
        var so = new SWFObject("mcslickvideoplayer4.swf", "MyFlash", "300", "300", "9", "#FFFFFF");
        so.write("flashcontent");
</script>
0
 
VBBRettAuthor Commented:
Any clue as to why it is not working for me?
0
 
aibusinesssolutionsCommented:
Did you fix the case sensitive issue that I mentioned in my last post?  Do you have the page uploaded somewhere so I can look at it if that didn't fix it?
0
 
VBBRettAuthor Commented:
Actually, swfobject is how it is supposed to be showed or displayed.  SWFObject was not recognized.  When the Javascript file was opened, I saw that SWFObject was spelled swfobject as opposed to SWFObject.
0
 
VBBRettAuthor Commented:
I'm not sure if you saw my page output, but I have an output that has a white box where the video should be.
0
 
aibusinesssolutionsCommented:
I'm not sure which javascript file you are looking at, the link I gave you has

var SWFObject=deconcept.SWFObject;

The only "swfobject" I can find is on the first line, and that's part of the URL to download it.
0
 
VBBRettAuthor Commented:
Can you post the link again?  THis is not working out for me.  My Flash file is not working and all I want to play is an mp4 file through flash.  I tried to use Dreamweaver to play the file or put code in and I still get the same thing as before, a white box.  Here is the code I used.  Is this using an older version of Flash and am I supposed to update the code to a newer flash?  Would you be able to just submit for me a html page that works for you?  My swf file is called mcslickvideoplayer4.swf and my mp4 file is called comingsoonmcslick4.mp4.  Why this is not working out for me is beyond me.  I thought this was supposed to be simple and I was able to make Flash work for me before but I don't understand why it won't play.
0
 
aibusinesssolutionsCommented:
You can modify what version of flash is required with the SWFObject declaration.

var so = new SWFObject("mcslickvideoplayer4.swf", "MyFlash", "300", "300", "9", "#FFFFFF");
mcslickvideoplayer4.swf = flash file to load
MyFlash = ID
300 = width
300 = height
9 = minimum flash version 9
#FFFFFF = background color white

Here is a screen capture of what my source code and directory structure, everything is working fine for me with it.

http://screencast.com/t/2dfLtHy9dn
0
 
aibusinesssolutionsCommented:
If you could zip and upload your files somewhere, I could download them and see what is wrong if you are still having problems.
0
 
VBBRettAuthor Commented:
Sure, I will send you the files.  Give me a second.  Is there a place I can upload a file that is larger then 7 megs but less then 8 megs?
0
 
aibusinesssolutionsCommented:
Yeah, if you have a windows live account, just use the skydrive, put it in the public folder and then give me the link.

http://skydrive.live.com
0
 
VBBRettAuthor Commented:
Here is a link.  By the way, ignore alot of the files.  Focus on WebForm.aspx.  Thanks.  Here is the link:

http://uploading.com/files/6ZY71R3M/MCSlick.zip.html
0
 
aibusinesssolutionsCommented:
Ok, first error.

<script type="text/javascript" src="js/swfobject_source.js"></script>

should be

<script type="text/javascript" src="js/swfobject.js"></script>

Second problem, the swfobject.js file that you have is all messed up, download this one, right click and hit Save As... http://blog.deconcept.com/swfobject/swfobject.js
0
 
aibusinesssolutionsCommented:
Flash errors:
SecurityError: Error #2148: SWF file http://localhost:52398/MCSlick/mcslickvideoplayer4.swf cannot access local resource C:\Users\xxxxxx\Documents\Visual Studio 2008\Projects\MCSlick\MCSlick\video\comingsoonmcslick4.mp4.

You need to put comingsoonmcslick4.mp4 for the source, not the entire file path like that, or remove that code so you can just use the FLV Playback control.

Error #2044: Unhandled skinError:. text=[IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2035: URL Not Found. URL: SkinOverPlaySeekMute.swf"

You need to have the file SkinOverPlaySeekMute.swf in the same directory as your flash file, so it can load the video player skin.
0
 
aibusinesssolutionsCommented:
Also, you didn't include the FLA file so I can't fix anything in the flash.
0
 
VBBRettAuthor Commented:
Sorry about that.  I'm going to be sending or uploading the Flash file momentarily.
0
 
VBBRettAuthor Commented:
Hi aibusinesssolutions, here is the FLA file.  Please let me know what needs to be changed in order for this whole thing to work out.

http://uploading.com/files/9LTH0D4N/mcslickvideoplayer4.zip.html
0
 
aibusinesssolutionsCommented:
Ok, I got it all working on my end and zipped it all up. Here you go:

http://cid-4ac4722874deb647.skydrive.live.com/self.aspx/Web/MCSlick.zip
0
 
VBBRettAuthor Commented:
You are amazing!!  What ever did you do?  That is awesome that you got it to work!!!
0
 
aibusinesssolutionsCommented:
The skin file for the flash player was missing, if you notice in the video folder I have the skin file, the flash player, and the video.

If you look at the FLA file, the skin is pointing to video/skin.swf, and the video is pointing to video/video.mp4

I also added some styles on default.aspx to center the video since I figured that's what you were going for.
0
 
VBBRettAuthor Commented:
aibusinesssolutions, thank you very much for your help.  I wish I could reward you with more but 500 points is all I have to give.  Thank you very very much!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 17
  • 17
Tackle projects and never again get stuck behind a technical roadblock.
Join Now