Solved

Play .avi in new window

Posted on 2001-08-31
12
398 Views
Last Modified: 2010-05-18
I want to create a link that would open a new window,automatically play an .avi file. and automatically close afterwards.
0
Comment
Question by:kaushalshah
  • 4
  • 3
  • 2
  • +3
12 Comments
 
LVL 1

Expert Comment

by:FranzRinkleff
ID: 6445284
use the following for the link

<a href="javascript:window.open('aviWindow.html', 'newAviWindow', 'width=200, height=200')">Play AVI File</a>


In the file called aviWindow.html embed your avi file with the following.

<embed src="locationofAviFile.avi" loop="2" autostart="true"</embed>
0
 
LVL 1

Expert Comment

by:Ernest022699
ID: 6448410
Just make sure that the user WANTS to play the avi file!  There are too many Site out there now which play annoying and intrusive sounds (which, by the way, consume bandwidth to download).
0
 
LVL 4

Expert Comment

by:daluu
ID: 6449473
FranzRinkleff, your code is good but not complete in that it does not auto close the window afterwards.

I believe user consent shouldn't really be a problem since the new window opens after a link is clicked instead of auto popup when the index page loads, etc. So the user expects a video anyways. What the user wouldn't expect might be a popup window. Therefore, kaushalshah, when you have found your code, be sure to let the user know the video will be in a new window instead of the current one. Many people hate popups including me.
0
 

Author Comment

by:kaushalshah
ID: 6454142
FranzRinkleff, I have tried your code but when the new window opens up to play the .avi file, the parent window goes blank with on "[object]" written on it.   Am I missing something?
0
 
LVL 4

Expert Comment

by:daluu
ID: 6462226
kaushalshah,

FranzRinkleff's code may have a javascript conflict with the HTML code. See, the url for href="url" in the hyperlink is the javascript code. The javascript code will work but the parent window will go to the javascript code when the user clicks the link. (How can anyone go to a javascript code? - its not a url or page)

Here is a good solution which I have used to overcome that problem before. Try this hyperlink code:

<a href="theparentwindowurl" onclick="window.open('aviWindow.html','newAviWindow','toolbar=0,menuBar=0,scrollbars=0,resizable=0,width=200,height=200,left=0,top=0');">Click here for popup AVI movie.</a>

Then use the same embed code.

With this code, the new window pops up when the link is clicked and the parent window will just refresh itself.

FYI toolbar=0 means no toolbar, so toolbar=1 means yes. left and top specifies where the window will be located (in pixels) based on the reference point of the upper left corner of the screen.

If you don't like a refreshing parent window, you will need to use pure javascript without the hyperlink which will make the supposed link to not look appear as a link.

I can also post you code for pure javascript or closing the popup window upon request. But I suggest that it is simpler to let the user click the close button on the window instead and to use the code I have posted above.
0
 
LVL 1

Accepted Solution

by:
FranzRinkleff earned 20 total points
ID: 6462395
Sorry I did not respond sooner.  I have not been reading much of my mail lately.  

I inverted two values in my previous message.

use the following

in the file called aviWindow.html put the following link

<a href="javascript:window.open('newAviWindow.html', 'aviWindow', 'width=200, height=200')">Play AVI
File</a>

in the file called newAviWindow.html

put the following

<embed src="locationofAviFile.avi" loop="2" autostart="true"</embed>

the attributes kaushalshah placed in his javascript to open a new window are pretty useful.  However you can just do the following as well to make it show the toolbar, the location bar, be resizable or have scrollbars.  a little less typing and i find easier to read. when i use pop-up windows i usually like to remove the location and toolbars. i also can find pop-ups annoying but usually only if they are ads.  i often find them useful when i am processing a form or something which i do not want the user to use the back button or change the location by accident.  

<a href="javascript:window.open('newAviWindow.html', 'aviWindow', 'width=200, height=200' height=575 toolbar, location, resizable, scrollbars')">Play AVI
File</a>


0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 4

Expert Comment

by:daluu
ID: 6465592
If you don't care about the window size and location of the new popup window, and whether there are toolbars, scrollbars, etc., you can use this hyperlink code instead. It's much simpler and less typing:

<a href="aviWindow.html" target="_blank">Click
here for popup AVI movie.</a>

then in aviWindow.html, use the same embed code.

This will essentially do the same thing without javascript and the object error.

Last, if you do care about window size/location, toolbars, etc., and you want a link without reloading the parent window, you can use a form button or form image input instead of the hyperlink. I can post code for that too if you want.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6629533
This question has been abandoned.  I will make a recommendation to the
moderators on its resolution in a week or two.  I appreciate any comments
that would help me to make a recommendation.

Cd&
 
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6694643
It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

<recommendation>
points to FranzRinkleff

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&
0
 
LVL 4

Expert Comment

by:daluu
ID: 6695424
I don't want to seem harsh but FranzRinkleff's hyperlink code is not very aesthetic as one can conclude according to the user, kaushalshah's reply to FranzRinkleff above and through thorough testing.

In the follow up reply, FranzRinkleff did not answer the user's question regarding "the parent
window goes blank with on '[object]' written on it" problem. The code basically neglect's the parent window url change, as all hyperlinks must do. A simple href="#" in the hyperlink would have solved the problem.

Therefore, I wouldn't call FranzRinkleff's comments a satisfactory solution.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6696277
The original question is answered, and for 20 points you can expect a lot of followup.

Cd&
0
 

Expert Comment

by:ComTech
ID: 6696366
Answer accepted by:

ComTech
Community Support
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now