Embedding URLs in Digital Media Content

Kim Vu
Microsoft Digital Media Division

August 2001

Summary: This article details how to insert URLs into your audio or video files to improve the content you provide your audience. You will also learn how to extend the capability of URLs by embedding the Microsoft Windows Media Player ActiveX control object model into a Web page. (5 printed pages)

Introduction

Whether you are creating content for distance learning and corporate presentations or extending branding efforts, inserting Uniform Resource Locators (URLs) in your digital media files creates interactive, synchronized presentations. By combining the power of the Web and Microsoft® Windows Media™ Player, you form an environment that not only engages the audience, but also communicates your content's message more effectively.

Embedding URLs in your digital media content provides users with a richer, more interactive experience. Unlike a traditional digital video or audio file, digital media content with embedded URLs offers a complete, synchronized presentation that combines two powerful technologies: Microsoft® Windows Media™ Player and your Web browser. When the Player encounters a URL in the digital media file, your default browser will start up and display the corresponding Web page. Using URLs with your digital media content ensures that users are directed to the specified Web sites at the appropriate position in the file.

This article details how you can improve the content you provide your audience by embedding URLs in the digital media file and how you can customize the behavior of embedded URLs with the Windows Media Player ActiveX® control object model.

This article contains the following topics:

  • About URLs
    Briefly describes Uniform Resource Locators.
  • Embedding URLs in Digital Media Files
    Briefly describes the Advanced Script Indexer and how to set URLs in a digital media file. 
  • Extending the Functionality of URLs in Scripts
    Describes ActiveX properties associated with embedding URLs in a digital media file.
  • Code Sample Using URLs
    A complete sample of how to use URLs in a script.

About URLs

A Uniform Resource Locator (URL) is an Internet address, usually composed of an identifying protocol, host computer, directory, and file name. URLs are commonly used for accessing files from another computer or network. For example, a URL can be a hyperlink to an online resource, such as a Web site.

Embedding URLs in Digital Media Files

You can embed URLs in your digital media files by using Microsoft Windows Media Advanced Script Indexer. The Advanced Script Indexer is a tool that enables you to insert and edit scripts within any Windows Media file. You can insert any number of URLs in a file, but only one URL can exist at a specified position in the digital media file.

When an embedded URL is encountered in a digital media file, Windows Media Player automatically launches the default Web browser and displays the Web page specified. This feature is called a URL flip. URL flips enable you to synchronize Web pages with specific points in your digital media files.

To obtain more information about embedding URLs or the Advanced Script Indexer, download the Windows Media Resource Kit from the Windows Media Technologies Web site.

Extending the Functionality of URLs in Scripts

The ActiveX object model provides properties that you can use to extend the functionality of URLs in scripts. Inserting URLs into your digital media files and embedding the Windows Media Player ActiveX control in a Web page results in a powerful, synchronized presentation that is organized and convenient for your audience.

The Web provides many opportunities to take advantage of URL flips. For example, this feature can provide an interactive solution for Web-broadcasted distance learning. By using the ActiveX control in a script, you can create a set of framed Web pages. One frame can contain the embedded ActiveX control for playing the audio or video lecture, while another frame displays the synchronized URLs encountered in the digital media stream. The URLs can be links to additional study tools, diagrams, lecture notes, or a quiz available on the Web. URL flips offer many benefits and can be tailored to match your audience's needs.

The Windows Media Player ActiveX control object model has two main properties related to URL flips: invokeURLs and defaultFrame. These properties are exposed through the Player root object and Settings child object. A description of these properties is contained in the following topics.

Defining the invokeURLs Property

You can use the Player.Settings.invokeURLs property to determine whether to process the URL encountered in the stream. The invokeURLs property has two Boolean values: true and false. Setting the invokeURLs property to true will launch the default browser and display the corresponding URL encountered in the digital media file. Setting the invokeURLs property to false will not launch the default browser.

Defining the defaultFrame Property

You can use the Player.Settings.defaultFrame property to specify or retrieve a string value containing the name of the frame in which you want the Web page to display.

The following HTML example shows how you can use the ActiveX control and the defaultFrame property to display the video in a frame. The Player object id is Player1, and the defaultFrame property is set to right.

<OBJECT ID="Player1"
  CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
  <PARAM NAME="AutoStart" VALUE="False">
  <PARAM NAME="defaultFrame" VALUE="right">
  <PARAM NAME="UIMode" VALUE="none">
</OBJECT>

Code Sample Using URLs

The following HTML code creates a Web page with two frames, left and right.

<HTML>
<HEAD>
<TITLE>URLs Flips Sample: Frame set page</TITLE>
</HEAD>
<!--The frame set contains two frames, left and right. 
    They will display the specified Web page.--> 
<FRAMESET cols="50%,50%">
      <FRAME src="leftpage.htm" id="left" name="left">
      <FRAME src="ritepage.htm" id="right" name="right">
</FRAMESET>
</HTML>

The following HTML code creates a Web page to be displayed in the left frame.

<HTML>
<HEAD>
<TITLE> URL Flips Sample:Left page</TITLE>
</HEAD>
<BODY>
<H1>URL Flips Sample</H1>
<!--Embeds the Windows Media Player Player ActiveX control.-->
<OBJECT ID="Player1"
  CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
  <PARAM NAME="AutoStart" VALUE="False">
<!--Sets the frame to display the URL --> 
  <PARAM NAME="defaultFrame" VALUE="right">
  <PARAM NAME="UIMode" VALUE="none">
</OBJECT>
<p>The URLs embedded in the media will play in the right frame.</P>
<!--Creates two buttons to control playing and stopping content.-->
<INPUT TYPE="BUTTON" NAME="BtnPlay" VALUE="Play" OnClick="StartMeUp()">
<INPUT TYPE="BUTTON" NAME="BtnStop" VALUE="Stop" 
      OnClick="ShutMeDown()"><BR><BR>
<!-- JScript code to play and stop the digital media file.-->
<SCRIPT>
<!--
function StartMeUp ()
{
<!—Player1.URL specifies the location of the digital media file.-->
   Player1.URL = ".\\..\\media\\glass.wmv";
   Player1.controls.play();
}
function ShutMeDown ()
{
   Player1.controls.stop();
}-->
</SCRIPT>
</BODY>
</HTML>

The following HTML code creates a Web page to be displayed in the right frame. This Web page is simple and displays a default message. The right frame is the frame specified to display the URLs encountered in the digital media file by defaultFrame.

<HTML>
<HEAD>
<TITLE> URLs Flips: Right page </TITLE>
</HEAD>
<BODY>
<P>Watch this space!</P>
</BODY>
</HTML>

For More Information

For more information about Windows Media Player 7 and later, or for a complete Microsoft JScript® sample about URL flips, download and install the Windows Media Player Software Development Kit (SDK) from the Windows Media Technologies Web site.

For more information about Windows Advanced Script Indexer, download and install the Windows Media Resource Kit from the Windows Media Technologies Web site.