Media Player SDK

Source: Internet
Author: User
Abstract: Learn how to change the appearance and behavior of Windows Media Player and how to embed it into a web or Windows-based application Program And how to use the plug-in object to extend its functions. This article introduces the Windows Media Player software development kit (SDK) and describes the usage of these features.

Introduction

Microsoft Windows Media Player provides excellent playback performance for digital audio and video, but your business may need to display more information or modify the playback mode of the video or audio content. With the Windows Media Player software development kit (SDK) (codenamed "Corona"), you can extend the functions of the independent player and embed the playback function into your own applications. This article provides an advanced overview of the SDK, covering the three main functions described below. This article applies to decision makers and programmers who are new to digital media programming.

Can I embed player into a web application or Microsoft Windows? . Windows Media Player has a modular architecture that allows you to use only the required parts. In particular, the user interface is independent of the playing functions of audio and video content. You can use the player playback function and decide whether to use the player's existing user interface or create your own user interface in the application.

Windows Media Player provides the appearance function. You can use this function to create a personalized player appearance, or create different functions based on the player.

You can also create a plug-in to extend the player's main functions by adding a new interactive control to the user interface and modifying the player before it presents audio or video data, then, non-standard data streams are displayed in the Windows Media File.

This article includes the following topics:

1. Create a player application. This section describes how to embed the Windows Media Player function in a web or Windows-based application.

2. Create the appearance. This section describes how to change the appearance and behavior of Windows Media Player.

3. Create a plug-in. This section describes how to modify the appearance and behavior of Windows Media Player. This includes presenting proprietary content, modifying audio or video playback, and providing new functions through interactive controls.

Create a player Application

Windows Media Player includes Microsoft ActiveX used to present videos and audios? Control. This control can be obtained on any computer running Windows Media Player. Windows Media Player is an independent technology. In addition, it also includes a Component Object Model (COM) in the form of ActiveX controls) server (the relationship between player and ActiveX control is equivalent to that between Microsoft Internet Explorer and the webbrowser ActiveX control provided by Microsoft Internet Explorer ).

You can use either of the following methods to create an application that uses the Windows Media Player ActiveX control. You can use this control in a web application or a Windows-based application.

To use Windows Media Player in Web applications, an object element should be included in the hypertext markup language (HTML) of the page. The object element contains nested Param elements to specify whether the Windows Media Player ActiveX control is visible, which operation buttons are contained, and other properties of the control. By Containing Multiple object elements, You can include multiple controls on a web page. To fully control the embedded player, you can write scripts in the HTML of the page.Code.

To use Windows Media Player in a Windows-based application, you can include a reference to the dynamic link library (DLL) serving the control. For example, in Microsoft Visual Basic? In, use the components (Component) dialog box to set a reference to "Windows Media Player" (this is the help name of the library in the WMP. dll file.

How to Set control properties depends on the programming environment used. For example, in Visual Basic, use the custom Properties dialog box to set properties during design. You can also set or read attributes and call methods at runtime by writing code.

End users can run the application on any Windows-based computer with Windows Media Player installed. They can listen to audio or watch videos on user interfaces that are already familiar with (or created by you.

Enterprise programmers can simply use the player playback function and focus on the specific business needs of applications.
Create appearance

You can use the appearance Technology in Windows Media Player to change the appearance of the player while maintaining its standard behavior. The appearance of player is the embodiment of this function. Although these appearances make the player look quite different, they all retain basic functions such as play and pause buttons, display playlist, and return to full mode.

You can also use appearance technology to create an application with a very different appearance and behavior from the standard player. You can add various controls to the appearance to perform custom operations. To customize an operation, can I write a JScript? Code. You do not need to be proficient in Microsoft Visual C ++? Or Visual Basic, you can use the appearance technology as a programming platform.

You can compress the appearance definition file, image file, and any JScript file to a single file with the file extension. wmz. This is the standard way to provide the appearance to the end user.

You can also create a special appearance called a border, which is displayed in the now playing (PLAYING) function of Windows Media Player in full mode. You can compress borders, playlist files, and digital media files to a single downloadable file with the file extension. WMD. When the end user clicks. when linking WMD files, Windows Media Player will decompress all the contained files and apply the border to the now playing function, then start playing the specified content in the playlist file.

This downloadable file function is especially suitable for providing excellent entertainment or educational content to end users. It does not require end users to perform any installation while allowing you to perform extensive customization.

Create a plug-in

The Windows Media Player SDK supports a wide range of interfaces. To extend the basic functions of player, you can compile COM objects that use DLL files.

The SDK contains a visual C ++ wizard that allows you to create a sample plug-in project. This project contains the Code required to compile and register the plug-in and an example implementation. After running the wizard, you can focus on the specific code required to implement the plug-in.

With the extension provided by the plug-in, you can use Windows Media Player as a platform for providing and operating digital media content. There are several different types of plug-ins that will be discussed in the following topics.

Visualization effect plug-in

When the player is in full mode or appearance mode (depending on the appearance), the visual effect plug-in can play now playing (PLAYING) to the player when only the audio content is played) function to add interesting dynamic images. The visual appearance and dynamic motion are based on and synchronized with the music being played.

Implement the visualization effect as a COM object. Player triggers events for the selected visualization effect multiple times per second. This event contains the following data:

1. timedlevel structure, which includes the current audio frequency and volume information

2. device context handle, used to specify the drawing surface

3. rect structure, defining the size of the drawing surface

Implement the render method for processing this event in the visualized effect object.

Can I use the Windows Graphical device interface (GDI) function, Microsoft direct3d? Or DirectDraw? Functions and other technologies for Visual Programming of graphics.

When calling the GDI function that uses the device context, the example generated by the Windows Media Player Plug-in Wizard uses audio and volume data (in the timedlevel structure ). You can modify or replace this implementation to generate the desired visualization effect.

This wizard can be used to compile all the code for self-registered com DLL. To see the visual effect, you only need to compile the project, run Windows Media Player, and select a new visual effect.

User Interface plug-in

Windows Media Player provides end users with various information and functions. However, you may need to provide Custom interaction or data. You can use the user interface plug-in to complete this task.

The full mode of Windows Media Player consists of many areas, such as the now playing function and the playlist pane. Some regions are invisible by default, but end users can make them visible. These areas include the setting areas that are displayed at the bottom of the now playing function and the metadata areas that are displayed above the playlist.

There are five types of user interface plug-ins. Three types are displayed in different regions of player. Only one plug-in can be enabled in each region at a time.

1. Display plug-in. These plug-ins occupy the visible display area of the now playing (PLAYING) function. This area is usually large, so it is suitable for displaying large amounts of data or complex interactive control sets.

2. Set the plug-in. These plug-ins are located under the visualization display area of the now playing (PLAYING) function. This area contains a graphical balancer, video settings, and other controls used to configure the playback or Windows Media Player appearance. The setting plug-in is suitable for adding similar custom functions and enabling end users to configure the appearance or behavior of the player.

3. Metadata plug-in. These plug-ins are located in a small area above the playlist. They are suitable for displaying the exact information of a track, album or playlist, and for simple controls or hyperlinks. For example, Windows Media Player contains a metadata plug-in that displays a cover image that is a link to more information about the currently played album set and musician.

There are two types of user interface plug-ins that are not displayed in the Windows Media Player window.

1. Window plug-in. These plug-ins occupy a separate window. They are suitable for displaying information or providing end users with interactive operations that always exist when switching from now playing to other functions or loading other plug-ins.

2. Background plug-in. These plug-ins do not have a graphical interface (unless they provide property pages as they do for any plug-ins ). They are suitable for automatic services that do not require end users to input.

The Windows Media Player Plug-in Wizard can create sample implementations for each type of user interface plug-in. You can modify the implementation details to provide the required functions, compile the project, and then use the player test plug-in. This wizard includes all the code required to compile the self-registered com DLL, so you can focus on the special needs during encoding.

DSP plugin

The digital signal processing (DSP) Plug-In modifies digital media streams during playback. Using the DSP plug-in, you can change a color video to a black or white video, or use reverse colors to make the image look like a negative film. You can also add vibrato or echo effects to the audio. When the plug-in processes digital media content, it changes the playback of the content. The DSP plug-in is different from the visualization effect plug-in. The latter receives digital audio data in the form of seed values to generate visual output, but does not affect the audio playback itself.

In addition to the Windows Media Player SDK, Microsoft DirectX? SDK. These plug-ins have an obvious feature, that is, implementing the imediaobject interface provided by the DirectX SDK.

When the DSP plug-in is installed and activated on the end user's computer, Windows Media Player transmits audio and video data to the plug-in before the data is presented. Player allocates the input buffer and output buffer, and enables the plug-in to access these two buffers. Methods of the imediaobject interface must be implemented to read data from the input buffer, process the data in any way applicable to the plug-in, and then write the modified data to the output buffer. Windows Media Player displays the data obtained from the output buffer.

You can run the Windows Media Player Plug-in Wizard to create an example of DSP plug-in. This example implements the imediaobject interface and implements a utility function called doprocessoutput. In many cases, you only need to use the specific code of the DSP plug-in to modify this utility and use all other code provided by the wizard.

Rendering plug-in

You can use the Windows Media Format SDK to add any data streams to the Windows Media File. The format of this data stream is unrestricted, including formats that cannot be recognized by Windows Media Player by default.

There are two ways to render Windows Media files that contain such data streams.

1. You can write a custom playback application. In this case, in addition to the code used to present your specific content, the code used to provide standard audio, video, and script streams, and the code used to display the user interface must also be included.

2. You can also compile a rendering plug-in for Windows Media Player. In this case, you still need to write code to present your specific content, but you can use the inherent features of player to present supported streams and provide the user interface that the end user already knows.

The Windows Media Player Plug-in Wizard allows you to create an example for rendering the plug-in. In this example, you can implement many interfaces required for rendering the plug-in, and also implement a utility function called dorendering. You only need to modify this utility by using the code used to present a specific stream and using all the other code provided by the wizard.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.