I've been looking for a way to play videos at some point in my application, I was thinking of ways to incorporate them into a texture or just plain render them but I'm literally stumped here, any suggestion? I'm not in a position to choose, but I'd really appreciate sample codes.
You could do it with OpenGL for example: play AVI files
I'd include the source of the link but since it's a full fledged tutorial that would be too long.
Another option would be to just have the media player start. Most players have start parameters that you can use.
for example:
#include <windows.h>
int main()
{
HINSTANCE hRet = ShellExecuteA(
HWND_DESKTOP, // Parent
"open", // Operation
"C:\\yourMovieDirectory\\yourMovie.avi", // Path to file
NULL, // Parameters
NULL, // Default dir.
SW_SHOW); // Opening option
if( (LONG)hRet <= 32 )
{
MessageBox( HWND_DESKTOP , "Error detected while attempting to start the movie!") , "Error" , MB_OK );
}
return 0;
}
You need the shell32.lib for the ShellExecute() function
HINSTANCE is a handle to an instance. C++ Windows Types
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.