Click here to Skip to main content
15,890,282 members
Articles / Mobile Apps / Windows Mobile

Video Streaming in Pocket PC 2002

Rate me:
Please Sign up or sign in to vote.
3.91/5 (12 votes)
20 Apr 2004CPOL1 min read 147.9K   1.1K   43   33
An article on creating a streaming video player for Pocket PC.

Introduction

This project introduces you to use Microsoft Media Player SDK to write a simple video player for Pocket PC 2002

Background

  • Embedded Visual C++ 3.0

Using the code

  • First, download the SDK and install to the system. It would be in the directory C:\WMSDK\WMPktPC\
  • Open the sample project: C:\WMSDK\WMPktPC\Samples\MediaBookmarker\MediaBookmarker.vcw

The sample project present how to play a video file locally. To play a video through http we must use the additional functions provided in PlayerOCX.h. First look at the CMediaBookmaker.h to see the variables

CComPtr<IWMP> m_spWMPPlayer; // A pointer to the 
  //Windows Media Player control interface

To play an video file we can use the function Play() like this

m_spWMPPlayer->Play();

Second, create a text box for user enter the URL

LRESULT CMediaBookmarker::OnCreate(UINT uMsg, 
   WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
..........
..........
..........
h_editURL=CreateWindow(TEXT("EDIT"), 
  TEXT("http://www.somewhere.com/video.wmv"), 
  WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL| BS_TEXT, 
  0, 20, 220, 20, m_hWnd, (HMENU)IDB_TXT_ADDRESS, hInst, NULL);

//
CreateWindow(TEXT("BUTTON"), TEXT("Go"), 
  WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 
  220, 20, 20, 20, m_hWnd, (HMENU)IDB_GO, hInst, NULL); 


h_btnAbout=CreateWindow(TEXT("BUTTON"), TEXT("MediaBookmarker"), 
  WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 
  0, 40, 240, 20, m_hWnd, (HMENU)IDB_ABOUT, hInst, NULL);
..........
..........

}

The variable h_editURL was declared in the CMediaBookmaker.h

HWND h_editURL; // the handle for Edit box 

Then we create the function that handle the action click on the button Go (CMediaBookmaker.h )

BEGIN_MSG_MAP(CMediaBookmarker)
   .....
   .....
   .....
   COMMAND_ID_HANDLER( IDB_GO, OnGoURL)
   .....
   .....
END_MSG_MAP()

LRESULT OnGoURL( WORD wNotifyCode, WORD wID,
  HWND hWndCtl, BOOL& bHandled);

Then back to the CMediaBookmarker.cpp to edit the function OnGoURL

LRESULT CMediaBookmarker::OnGoURL(WORD wNotifyCode, WORD wID, 
  HWND hWndCtl, BOOL& bHandled)
{
 CHAR *m_strURL="";

 //h_editURL
 SendMessage(h_editURL,WM_GETTEXT,256,(LPARAM)m_strURL);
 // Send a windows message to get the value of the textbox in the program. 

 SendMessage(h_btnAbout,WM_SETTEXT,256,(LPARAM)m_strURL);
 // Set the Text in Button About to test . Do not need to use this code 

 // And finally use put_FileName() function to prepare to play
 m_spWMPPlayer->put_FileName((unsigned short*)m_strURL); 

 m_spWMPPlayer->Play(); // Play the media from the URL 

 return 0;
}

Points of Interest

This code was tested on the Acer n10 Pocket PC 2003 using SENAO wireless card. We can play the file remotely in the web server.

I am just a new comer. I have many difficulties when doing the video project on Pocket PC. Now I find this code is interesting and would like to share with you. Finally, thanks for your concerns !

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Vietnam Vietnam
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralRe: Linking Error Pin
Humphrey Chakma14-Mar-05 18:29
Humphrey Chakma14-Mar-05 18:29 
GeneralRe: Linking Error Pin
index4920-Jul-04 10:10
index4920-Jul-04 10:10 
GeneralRe: Linking Error Pin
metalhammer_126-Mar-06 6:43
metalhammer_126-Mar-06 6:43 
GeneralRe: Linking Error Pin
kuiyuan7-Aug-07 3:53
kuiyuan7-Aug-07 3:53 
Generalcompile error by evc4! Pin
Member 56453128-May-04 5:29
Member 56453128-May-04 5:29 
GeneralMedia Player 9 on Pocket PC 2003 Pin
Remy Baudet6-May-04 4:21
Remy Baudet6-May-04 4:21 
GeneralRe: Media Player 9 on Pocket PC 2003 Pin
Remy Baudet6-May-04 6:01
Remy Baudet6-May-04 6:01 
GeneralRe: Media Player 9 on Pocket PC 2003 Pin
iamtony26-May-05 15:09
iamtony26-May-05 15:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.