Jump to content


Photo

Ultra Animo - Media Playback Dll (splash/intros)


  • Please log in to reply
32 replies to this topic

#1 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 04 April 2009 - 04:10 PM


UltraAnimo
v1.5.0.0


Description
With this dll, you can (re)play any type of media (as long as the right codec is installed). By playback, I mean you can:
--Play Pause Resume/Stop
--Set or get playback position
--Set or get volume
--Set or get video size and where it is played
--Set or get fullscreen mode
--Get video information (real size, length, quality)

Downloads
Dll, gml and small gm6 demo
--Location on Website (with more details)
--Code Preview (gml code only)
--Direct Download (whole package)
Demo Media Player (pretty cool!)
--Media Player (a media player by snabelost)

Dll size is only 377Kb but the download file is 2Mb (contains demo source[gm6] and demo executable).

Screen shots
...

Quick Example
PRE
// CREATE EVENT
ua_Init();
ua_LoadFile("Intro.mpg",window_handle());
ua_ShowsFullScreen(true);
showing_video=false;
PRE
// STEP EVENT
if (showing_video) { // if still showing video
if (ua_Status()!=global.UAS_PLAYING) { // if not playing anymore
showing_video=false; // not showing
ua_Fini(); // remove control, dll and cleanup.
}
}


Notices
--The video is played asynchronously, meaning, your game keeps running while the video is showing. So you have to keep checking the video's status until it is finished. In the future, I may add a feature to play in synchronous mode (game stops while video runs).
--The mouse cursor is not hidden over the video control (except when fullscreen), I intend to fix this in a later version.
--Messages sent to video control are relayed back to GM (eg GM can detect clicking (and even pressing keys) over the video control). This is not really a bug, in fact it may even be an advantage.
--Misshandling the dll calls my cause some serious errors (not serious as in damaging, but they end up crashing your game). Unfortunately, I can't handle this correctly. So, if for example you try to play a file without loading it first, the dll doesn't babysit your faulty code, you get a game crash (with a load of error messages). Please make sure you code this correctly by not asuming error handling on the dll part.
--To know if a format is supported, run it first through Windows Media Player.
--To know if a format is supported programmatically, use ua_LoadFile() and check for it's resulting value. If it starts with "Error loading file" and the file does exist and is not damaged then it's a codec problem. Of course, this message does not raise any errors in your game, nor does it crash the game.
--Proprietary formats such as MOV files cannot be played by default codecs (thanks to Caniac for finding this out). Since I do not want to force any format restrictions, I'll attempt to fix problems like these by hinting at how they can be tackled (links to codecs, etc).

Codecs
CCCP codec pack, supports a lot of codecs. (recommended pack).
3ivx codec supports MOV files.
Xvid open source codecs for MPEG support.
K-Lite Different K-Lite comparisons.

Credits
It is mandatory (in force) that you give credit to both creators of the dll and player:
-dll and enhancements: Christian Sciberras / Covac Software
-the actual media player control: Lord Dr. Andrei J. Sagura II von Orechov
Also, thanks to Mordi's great menu system, which I borrowed to make the demo program.
Lastly, a person worth mentioning is Sindarin, which gave the idea for this dll, and helped in forming its final shape at various stages.

Have fun with it!

Best regards,
Christian Sciberras

Edited by uuf6429, 10 April 2009 - 11:01 AM.

  • 1

#2 newbie013

newbie013

    GMC Member

  • GMC Member
  • 96 posts

Posted 04 April 2009 - 05:21 PM

So you have provide by your game the codecs of the media files you use with this dll O_O
  • 0

#3 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 04 April 2009 - 07:32 PM

I have yet to check this, but I asume you can play any simple file without requiring special codecs (thus not needing to distribute the codec with your game). You see, any computer (even not fully up to date) have a basic set of codecs installed by default.

Kind regards,
Chris.

Edited by uuf6429, 04 April 2009 - 07:33 PM.

  • 0

#4 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 04 April 2009 - 10:28 PM

So you have provide by your game the codecs of the media files you use with this dll O_O


Yes. Additional 627Kb for the Xvid setup package is not that bad when you have this kind of functionality, or you can get by, by using with the ugly MCI Game Maker video splash functions which have nearly half the functionality of this dll and when the codecs are not available will make your game crash...

What's the return value for ua_IsFullScreen? I keep getting 1 for no matter if I am playing the video in fullscreen or windowed.

Edited by Sindarin, 04 April 2009 - 11:47 PM.

  • 0

#5 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 05 April 2009 - 01:55 PM

What's the return value for ua_IsFullScreen? I keep getting 1 for no matter if I am playing the video in fullscreen or windowed.

Hmm... should be a GM boolean. I'll double check it.

Edit: I've checked it and even if it does seem to be interfaced correctly, it looks like it keeps returning false when no video is loaded and true when a video is loaded. But it does seem to change when changing screen mode.

Any idea of temporaly fixing this is by (insert each line of code before the return statement of each mentioned script):
-add a global variable "global.ua_ScreenMode=false;" inside ua_Init().
-add a the statement "global.ua_ScreenMode=argument0;" inside ua_ShowsFullscreen().
-add the statement "return global.ua_ScreenMode;" inside ua_IsFullscreen().
This is not a very good solution since fullscreen is canceled when a window pops up (default dll behaviour) and because of this code, it still thinks that fullscreen is enabled.
I'll investigate this bug further, you can use this suggestion till a fix is found.

Kind regards,
Chris.

Edited by uuf6429, 05 April 2009 - 05:09 PM.

  • 0

#6 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 05 April 2009 - 05:18 PM

If you don't want to mess with codecs then just use an old version of .wmv.
  • 0

#7 freaked

freaked

    freak up!

  • New Member
  • 890 posts

Posted 06 April 2009 - 09:40 AM

Wouldn't it be better to use use your ActiveX dll to embed VLC and then play the video ?
It doesn't even require the codecs
  • 0

#8 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 06 April 2009 - 11:14 AM

Wouldn't it be better to use use your ActiveX dll to embed VLC and then play the video ?
It doesn't even require the codecs

But it would require VCL media player.
  • 0

#9 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 06 April 2009 - 01:13 PM

Well, it's another option lol. But this is more direct, faster and better since it doesn't use a lot of system information (unlike GMAX).
Also, you will have to make your own scripts to do the basic movie stuff with GMAX (load play pause etc).

Also, for your information, VLC doesn't require codecs since it has it's own (public codecs). So, if you install VLC, you can still use this dll with those codecs. Otherwise, you can distribute small codecs with your game.
  • 0

#10 snabelost

snabelost

    GMC Member

  • GMC Member
  • 62 posts

Posted 07 April 2009 - 08:01 AM

I dont seem to find the set position script or any fast forward or rewind scrips...
*EDIT
i found the pos script

//ua_SetStreamPos
// Sets stream position
// Argument0 = position
// returns - integer
return external_call(global._ua_SetMediaStreamPos,argument0);

Edited by snabelost, 07 April 2009 - 09:22 AM.

  • 0

#11 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 07 April 2009 - 09:10 AM

Yes, some scripts are yet to be done, but if you check the init script you can find all of the existing features.
set/get position is possible (global._ua_SetMediaStreamPos and global._ua_GetMediaStreamPos)
rewind can be done via calling ua_Stop() and ua_Play() after each other
fast forward, there's not function for this, but I suppose you could skip frames by using StreamPos functions.

Kind regards,
Chris.
  • 0

#12 snabelost

snabelost

    GMC Member

  • GMC Member
  • 62 posts

Posted 07 April 2009 - 09:39 AM

Ok, i hawe the ua_FastForward and the ua_Rewind scrips to make it a bit easier
FAST FORWARD:
poss=ua_GetStreamPos
poss+=10000000
ua_SetPos(poss)

REWIND:
poss=ua_GetStreamPos
poss-=10000000
ua_SetPos(poss)

*EDIT
I cant get the ua_About to work properly, it only returns 4...

Edited by snabelost, 07 April 2009 - 10:29 AM.

  • 0

#13 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 07 April 2009 - 10:59 AM

That looks ok. I'll check it on mine and include it in the demo.

Hmm ua_About should return a string about the player's creator. Make sure you use ua_Init first.
  • 0

#14 snabelost

snabelost

    GMC Member

  • GMC Member
  • 62 posts

Posted 07 April 2009 - 11:32 AM

Sry, dont ment to bother you but i cant use the ua_CheckVideo, i just get a system message and a bug alert and a halt or ignore button, maby in using the script wrong... else dose ewerything gwork great
  • 0

#15 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 07 April 2009 - 01:27 PM

I should rename that script, it's a dummy script.
If you rn the demo, you'll find theexample "Cause Fault".
That error message is a new system I'm implementing in my new dlls (not exactly a system message). It handles errors better (and nicer then access violations, etc...).

If you get any other problems/queries, feel free to ask!

Kind regards,
Chris.

Edited by uuf6429, 07 April 2009 - 01:28 PM.

  • 0

#16 snabelost

snabelost

    GMC Member

  • GMC Member
  • 62 posts

Posted 07 April 2009 - 02:48 PM

K, i just made a little player from ur dll just to se if it works, this is only 30 min of work, dont expect too muche
Download "Mplayer.exe"
  • 0

#17 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 07 April 2009 - 03:42 PM

Wow! Pretty cool! I'll link it in first pos if you don't mind?

Edit: Actually, I find it difficult to believe that that is made with my dll, lol! Very good work!

Edited by uuf6429, 07 April 2009 - 03:48 PM.

  • 0

#18 snabelost

snabelost

    GMC Member

  • GMC Member
  • 62 posts

Posted 07 April 2009 - 07:24 PM

Wow! Pretty cool! I'll link it in first pos if you don't mind?

Edit: Actually, I find it difficult to believe that that is made with my dll, lol! Very good work!

I made a final update just to show how good this dll can make a media player work!
(its still the same link, just updated it)

ill send a open source when im done cleaning up the mediaplyer

Edited by snabelost, 08 April 2009 - 05:54 AM.

  • 0

#19 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 10 April 2009 - 01:47 AM

There's also the K-Lite Codec pack, I've been using it for a long time: http://www.codecguid...download_kl.htm
  • 0

#20 freko

freko

    The Professional

  • GMC Member
  • 504 posts
  • Version:GM8

Posted 10 April 2009 - 05:05 PM

Ya K-Lite Codec packs are always good it supports almost the codecs.. and I like the video playing asynchronously. Please don't change this or you can keep an alternate to
either play it asynchronously or synchronously.

Another thing; can this loop media?
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users