Hello guys I'm new on this field!
I can't get my *.avi working with <embed src="movie.avi"></embed> tag!!
Is there any other way to play diferent content (movies like)?Mybe some other script language like PHP? :cry:

Dani AI

Generated

originally tried an <embed> for a .avi file and it failed; 's object/embed approach later worked for that setup, but it relies on client-side plugins (Windows Media/ActiveX or similar). That plugin approach is platform- and browser-dependent and is fragile for modern sites. The reliable path today is to deliver video in codecs browsers actually decode and use the HTML5 <video> element.

A compact, practical workflow:

  • Convert the source .avi into modern web formats (MP4 H.264 + AAC for broad support, and WebM for open-source browsers).
  • Serve both formats and use <video> with multiple <source> entries so each browser picks a supported file. See the HTML5 video element documentation on MDN for details: HTML5 video element

Example HTML (use this instead of embed/ActiveX):

<video controls width="640" poster="thumb.jpg">
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.webm" type="video/webm">
  Your browser does not support the video tag.
</video>

To transcode with FFmpeg (common, reliable):

ffmpeg -i input.avi -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k output.mp4
ffmpeg -i input.avi -c:v libvpx-vp9 -b:v 1M -c:a libopus output.webm

Notes on PHP and servers: PHP cannot force playback, but it can set correct headers or stream files. For a simple serve:

<?php
header('Content-Type: video/mp4');
readfile('movie.mp4');

For seeking/fast-forward you must implement HTTP Range support on the server; see MDN on Range requests: Range requests

Troubleshooting checklist: inspect the file codecs (ffprobe), confirm Content-Type in the browser Network panel, ensure Accept-Ranges: bytes for seeking, check CORS if served cross-domain, and test in multiple browsers. Converting to MP4/WebM and using <video> solves the vast majority of playback problems.

Recommended Answers

All 2 Replies

you need to use the object tag and then use the embed tag with its application type like so: this will play mp3 files, just change the extensions and it should play avis too

<object id="MediaPlayer1" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="" 
standby="Loading Microsoft Windows® Media Player components..." type="application/x-oleobject" width="280" height="256"> 
<param name="fileName" value="one..mpg"> 
<param name="animationatStart" value="true"> 
<param name="transparentatStart" value="true"> 
<param name="autoStart" value="true"> 
<param name="showControls" value="true"> 
<param name="Volume" value="-450"> 
<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="one.mpg" name="MediaPlayer1" width=280 height=256 autostart=1 showcontrols=1 volume=-450> 
</object>

Eddie Traversa

DHTML Nirvana

http://dhtmlnirvana.com/

Spiritual Blog

http://www.truthrealization.com/

TNX 100^n times!!
It's working. :mrgreen:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.