Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / PlayVideoToImage on Apple Macintosh

Author
Message
Lupo4mica37
3
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 25th Aug 2020 00:45 Edited at: 31st Aug 2020 21:10
ORIGINAL PROBLEM:

I am aware that this is an existing issue, but for my needs, I need the video to act as a background for which I need to play it in an image, so as to create a sprite with it and move it to the back in depth, otherwise PlayVideo displays the video in front of everything else that needs to be visible. I encountered the problem whilst exporting part of my project to Apple Mac, that I am making on PC, however I do need it to be compatible with Apple Mac, for the software I am making will need to be available on Mac computers also.

Is there a way to solve this problem?

Thank you.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 25th Aug 2020 00:50
I'm not sure i understand what the problem is. I see what you're trying to do but what is the problem?
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 25th Aug 2020 01:01
Lupo4mica37
3
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 25th Aug 2020 01:54
Hi blink0k and fubarpk.

The problem is that on Apple Macintosh computers when I try to use the function PlayVideoToImage() it does not work, it kinda crashes the application. I am new to Apple computers myself, I just bought one, specifically for the purpose of being able to export my project to Apple Mac computers and iPhones, so I need to learn more about these machines and the limitations of AppGameKit on Mac and how to overcome them.

So far, I am only able to PlayVideo() or not play it at all, so that the entire code runs normally, though when I just PlayVideo() it shows up in front of everything else that needs to be visible. I can move everything to sprite depth 0 and the video is basically depth supreme.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 25th Aug 2020 02:12 Edited at: 25th Aug 2020 02:15
are you playing the video to an image https://www.appgamekit.com/documentation/Reference/Video/PlayVideoToImage.htm
you then can have that image applied to a sprite and set the depth for the video sprite

might help to see some code because it does work

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Lupo4mica37
3
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 25th Aug 2020 02:32
It works on Windows, but not on my Mac OS, that is the problem. All I do is take out PlayVideoToImage(1007) out of the equation and everything works fine, or I use PlayVideo() instead and everything works smoothly. This shows that the problem is in the function itself. There is an old thread on this matter and it seems the issue is still apparent, meaning you cannot use PlayVideoToImage on Mac computers for some reason, kinda strange. So I tried the same on AppGameKit Studio and it actually produces the error, meaning video to texture is not currently supported on Mac. The present day limitation for Mac computers. For the time being this is not the most important aspect of the project, however it does give it this extra feel to it.

PS fubarpk, I checked out your game Thingy and I must say that is some really good idea for a game, very addictive!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 25th Aug 2020 02:49 Edited at: 25th Aug 2020 02:51
Maybe try;




Are you sure your not using PlayVideo() and PlayVideoToImage() at the same time?
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 25th Aug 2020 14:48 Edited at: 25th Aug 2020 15:05
This is exciting.

I have missed a few updates and was totally unaware of this command, which has huge potential.

Quote: " I encountered the problem whilst exporting part of my project to Apple Mac, that I am making on PC, however I do need it to be compatible with Apple Mac, for the software I am making will need to be available on Mac computers also."


Has Apple changed its terms of use, in that you are required to develop Apple software on Apple Hardware, and not PCs???

If not, then I suspect that the problem is occurring because Apple has designed it that way internally. (they have always been proprietary by design)

Again, only a suspicion, but if you try developing on Apple hardware and the problem goes away, then the suspicion could be confirmed.

Quote: "
I am new to Apple computers myself, I just bought one, specifically for the purpose of being able to export my project to Apple Mac computers and iPhones, so I need to learn more about these machines and the limitations of AppGameKit on Mac and how to overcome them."

I bought a Mac Mini to develop for Apple, and I never had any good results either, but it was all new to me too.

Good luck if you try to use the Apple hardware to give it a try, because all I ever ended up with was a bouncing Icon.

From my understanding (what I have been told) there are Windows emulators for Apples, so that could be another option for your Mac users if an emulator would allow them to run your PC build.

Not the best solution, but if that is possible then I suspect many Mac users would already have an emulator installed on their systems. (again, all unknown to me because I do not use, or develop for, Apples anymore)

https://www.howtogeek.com/187359/5-ways-to-run-windows-software-on-a-mac/

https://windowsreport.com/pc-emulation-software/

it looks like Virtual Machines are an option, and that is what I use on a PC to emulate Linux servers for testing PHP scripts offline, so there are work-arounds for this issue if you cannot get it working the way you intended.

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
Lupo4mica37
3
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 27th Aug 2020 04:36
Hi guys!

Thank you for the advice.

For sure I am not double calling a playvideo command, everything works well with PlayVideo() command, except that it covers the screen with the video, instead of being behind. I am not sure to utilise your code blink0k, I will look into it another time, as I have not run the Mac since.

It's strange with this command on Macs as the command works on iPhones. Really odd. AppGameKit does not support this command for Mac computers. Using emulators is not an option, as I will not expect a Mac user to need an emulator to run this software, if it cannot run stand alone on a Mac, then it is not user friendly. It is meant to be a learning tool for learning a language without the person wanting to learn the language have to do a list of things to actually run the software, I could not expect that from anybody wanting to use the software.

So far, that is the only command that is problematic, the rest of the code works fine. I am developing on PC, but then will want to export it to Mac also, so I guess I will be checking how things work between the two computers to spot problems as they arise.

Have a good night guys and thank you for your help as always!
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 27th Aug 2020 09:41 Edited at: 27th Aug 2020 09:55
Quote: " everything works well with PlayVideo() command"

do not use playvideo use the following
https://www.appgamekit.com/documentation/Reference/Video/PlayVideoToImage.htm
https://www.appgamekit.com/documentation/Reference/Sprite/SetSpriteDepth.htm
you need to use both those commands for it to work the same on all platforms

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Lupo4mica37
3
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 28th Aug 2020 18:56 Edited at: 31st Aug 2020 21:11
Hi fubarpk,

I know, I have used this command originally and put the sprite behind the text. Like I said, the problem is not with using this command on Windows or Android and I think it will be good on iPhones as well, but as the documentation states:

Quote: "Currently this is only supported on iOS 7.0 or above, Android 4.0.3 or above, and Windows."


Hence, for the time being I am unable to use this command on Mac computers.

PlayVideo() is the only play video command that works on Mac.
Lupo4mica37
3
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 31st Aug 2020 21:15
Forgive me, however after testing this on a Mac computer it still does not work as on PC.

Basically, In AppGameKit Studio the PlayVideo() command will play the video behind sprites and text as default. Trying to do the same in AppGameKit Studio on a Mac computer yields the same results as AppGameKit Classic, meaning the video still displays in front of everything.

Have to be patient with this one. I will keep on attemting to solve this problem.
Lupo4mica37
3
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 3rd Sep 2020 01:41
I was able to overcome the problem by exporting the frames of the video to png images. I used VLC for that:

https://www.raymond.cc/blog/extract-video-frames-to-images-using-vlc-media-player/

Number 2 is for the VLC instructions of how to do it.

I did not export every frame, only every 3rd frame, so out of 30 FPS, 10 frames for every second were exported.

At first I tried loading the images and adding animation frames to one sprite, however with over 600 HD images, that resulted in a memory error of some sort. The max it could handle was about 140, but for performance sake I stack to 100 images per sprite animation.

I used 7 sprites in total. The longest is the loading of images, so that needs to be done first, then you add the images to the sprite as animation frames in turn 1-100, then PlaySprite() and once that is finished, I used if statements to add next set of images to the sprite and before that I would delete the previous sprite to free up memory and so on until all images have been played and then logic to restart the entire process.

An example code, though I am sure there are more efficient ways to do this:



And the function that handles it:



And reset when all images have been played:



At present, this is one possible way to play a video behind sprites and text on Mac computers as far as my testing and the effect is pretty interesting, maybe even better than the actual video, a bit trippy I would say. I played the frames at 15FPS, despite they are 10FPS exported images.

Also, I found that for Mac computers AppGameKit Classic functions much better than AppGameKit Studio. Basically in AppGameKit Studio, a lot of stuff didn't work, like the text for "PLEASE WAIT" kinda thing whilst loading video images did not even display in AppGameKit Studio, in AppGameKit Classic, no problem. Then after all images were loaded, the Sprite animation played correctly in AppGameKit Classsic, failed to display anything in AppGameKit Studio.

It seems like, AppGameKit Studio is not much updated for Mac OS. I do prefer to use the Classic version, so doesn't bother me that much, only means that when my project will get more involved in the Studio version, I might have more problems to solve on the Mac to make things work.

Also to use that image animation method to play a video, will use more memory in the exported exe for Mac. The actual mp4 video is about 50MB, the exported images of the video take up in total about 200MB and that is just 1/3 of all the video frames, so to export the lot would be like 600MB.

All in all, I think this kinda method makes pretty visually interesting dynamic backgrounds for anyone interested to use such for their games.

Still, this is not the actual solution to the PROBLEM, but it is a good temporary solution for the time being, atleast for me.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 3rd Sep 2020 18:03
FWIW, i've PM'd the author of this plugin which expands the functionality for video on windows while they were working on a version for mac in 2017.

they may have some insight so i included a link to this thread.
[My Itch.io Home] | [#LowRezJamAGK2020]
[AGK Resource Directory] | [TGC @ GitHub]
[CODE lang=AGK] Your Code Here [/CODE] | [VIDEO=youtube] VideoID [/VIDEO]
Lupo4mica37
3
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 3rd Sep 2020 18:42
Thank you Virtual Nomad. I was actually wondering about the inability to play several videos at the same time.

Login to post a reply

Server time is: 2024-04-26 16:02:16
Your offset time is: 2024-04-26 16:02:16