Skip to main content
Engineering LibreTexts

10.3: Playing Video

  • Page ID
    93841
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    There are no significant differences between accessing and playing video files versus audio files. Video files can be downloaded from the Web for local playback. Files in AVI and MPG formats are the most common types for downloads. Video files in WMV format can be streamed from a media server. These can be live broadcasts or digitized files for on-demand retrieval.

    Linking and Embedding Video Files

    A video file is downloaded by creating an <a> link with the URL to the file. The file is downloaded and opened in the external Media Player in the same fashion as for audio files.

    The following link connects to a WMV video file appearing in the same directory as this Web page. When the link is clicked, the file opens in the external Media Player. The exact manner in which the Media Player appears on your desktop depends on how it is configured.

    Casablanca

     Casablanca.wmv (484 KB)

    Figure \(\PageIndex{1}\): Links to play a video file.
        <a href="casablanca.wmv"><img src="casablanca.gif" alt="Casablanca"/></a>
        <a href="casablanca.wmv">Casablanca.wmv (484 KB)</a>
    
    Figure \(\PageIndex{2}\): Code to link to video file.

    Video files can be embedded in a Web page by using the <video> tag in HTML5. The following example is from w3.org - HTML5 Video Events and API

    Figure \(\PageIndex{3}\): Using a video tag to play video files.

     

     <video controls="" id="video" mediagroup="myVideoGroup" poster="http://media.w3.org/2010/05/sintel/poster.png" preload="none">&nbsp;</video>

        <video id='video' controls preload='none' mediagroup='myVideoGroup'
            poster="http://media.w3.org/2010/05/sintel/poster.png">
            <source id='mp4' src="http://media.w3.org/2010/05/sintel/trailer.mp4" type='video/mp4'>
            <source id='webm' src="http://media.w3.org/2010/05/sintel/trailer.webm" type='video/webm'>
            <source id='ogv' src="http://media.w3.org/2010/05/sintel/trailer.ogv" type='video/ogg'>
            <p>Your user agent does not support the HTML5 Video element.</p>
        </video>
    
    Figure \(\PageIndex{4}\): Code to use a video to play video files.

    Accessing Video Streams

    With availability of URL addresses for external sites, you can link to streamed video content. As with audio files, you may be able to grab the URL from the link if the video is playing through Windows Media Player. While the video is playing, right-click on the screen and choose "Properties" from the pop-up menu. From the Properties window, copy the full URL for the file being streamed.

    The following embedded video is linked by this technique. In this case, the URL points to a movie trailer located through a Web search.

    Figure \(\PageIndex{5}\): Embedding a streamed video file.
        <object id="PlayerX" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" style="width:400px; height:300px">
    		<param name="url" value="http://www.youtube.com/v/VsvaFxkXrbg&hl=en_US&fs=1&"/>
    		<param name="autostart" value="False"/>
    		<!--[if !IE]>-->
    		<object data="http://www.youtube.com/v/VsvaFxkXrbg&hl=en_US&fs=1&" id="PlayerX" style="width:400px; height:300px">
    			<param name="url" value="http://www.youtube.com/v/VsvaFxkXrbg&hl=en_US&fs=1&"/>
    			<param name="autostart" value="false"/>		
    		</object>
    		<!--<![endif]-->	  
    		<p>A sample Video Stream</p>
    	</object>
    
    Figure \(\PageIndex{6}\): Code to embed a streamed video file.

    Many Web-based video files have costs or fees for viewing. Also, you will often encounter video players embedded in pages of the site with settings that do not permit access to the Properties window for extracting URLs. You will simply need to be patient and persistent to find video to which you can link. Moreover, URLs are changed routinely. Later you may not be able to link to the video at its original location.

    Live video streams can be captured and played through the Media Player. The object tag can be further used for live video streams.


    10.3: Playing Video is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?