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 / Error trying to play video

Author
Message
rockethippo
10
Years of Service
User Offline
Joined: 25th Nov 2014
Location: Canada
Posted: 25th Nov 2014 00:57
I have a simple play video on click code

if GetPointerState()=1
LoadVideo("hey.mp4")
SetVideoDimensions(0,0,1024,768)
PlayVideo()

When I run it and click on the screen, for some reason it tries to open "Pinnacle Studio 16". Is there a way to fix it and have the video play when I click?

Attachments

Login to view attachments
easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 25th Nov 2014 02:17 Edited at: 25th Nov 2014 02:21
Can you please try this code?

I doubt it'll fix your error, but it's worth a shot
1. Does it work?
2. What is the number it prints to the screen?


If you're on windows, try a wmv file and see if it works with that.


Audacia Games - Latest WIP - AUTOMAYTE 2.1, AppGameKit one click deploy to Android
"When you've finished 90% of your game, you only have 90% left"
Harlequin
14
Years of Service
User Offline
Joined: 22nd Mar 2010
Location: Melbourne (AU)
Posted: 25th Nov 2014 02:22
from what I understand on Windows you need the correct codecs installed. Here is a link to a recent discussion on it that will offer some pointers.

The codes required for video playback are many and varied.

http://forum.thegamecreators.com/?m=forum_view&t=212321&b=41

hope this helps.

It's late, I'm tired, out of coffee and now I'm wet.
rockethippo
10
Years of Service
User Offline
Joined: 25th Nov 2014
Location: Canada
Posted: 25th Nov 2014 02:45
The Pinnacle studio window still comes up.

when I run your script I get "1 click to play video"

after clicking I get "1 video playing"
rockethippo
10
Years of Service
User Offline
Joined: 25th Nov 2014
Location: Canada
Posted: 25th Nov 2014 03:05
I did some tinkering and converting the video to wmv. fixed the problem. My new loop is:

do
if GetPointerState()=1

LoadVideo("heyy.wmv")
SetVideoDimensions(0,0,100,100)
PlayVideo()

endif

if GetPointerState()=0

pauseVideo()

rainbow=CreateSprite(loadimage("rainbow.jpg"))
SetSpriteSize(rainbow,100,100)

endif

Print( "I said hey!")
Sync()
loop

I'm trying to have the video only play if the mouse input is held clicked and then show "rainbow.jpg" if it is not clicked.

What my code currently does is if I hold down mouse click it will play "heyy.wmv" very choppy while constantly spawning "Active Movie Window" windows.

if I swap pausevideo() with deletevideo() , nothing plays while I am clicked.
Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 25th Nov 2014 04:48 Edited at: 25th Nov 2014 04:49
Quote: "What my code currently does is if I hold down mouse click it will play "heyy.wmv" very choppy while constantly spawning "Active Movie Window" windows."


Your LoadVideo should be outside of the main loop, right now when you click your mouse it is loading the video over and over again. Same with your rainbow image, create the rainbow sprite outside of the main loop and hide/show it when you want to.


Try this:




Sean

rockethippo
10
Years of Service
User Offline
Joined: 25th Nov 2014
Location: Canada
Posted: 25th Nov 2014 05:50
Thank you Sean for the reply!

There are still a few errors after I changed my code to match yours. Logically, it doesn't make sense to me after reviewing the code, but here's what happens when I run it:

Displays rainbow.jpg at first.

When I click it displays a still of the first frame of the heyy.wmv video, but no further video or sound.

After I release after first click, it doesn't return to rainbow.jpg.

If I click and hold after the first click and release, the video will play/stop with each click/release, but doesn't return to rainbow.jpg when it is released as I intended.

I messed around with my code but with no success.

rainbow=CreateSprite(loadimage("rainbow.jpg"))
SetSpriteSize(rainbow,100,100)


LoadVideo("heyy.wmv")
SetVideoDimensions(0,0,100,100)

do
if GetPointerState()=1
SetSpriteVisible(rainbow, 0)
playvideo()

PlayVideo()

endif

if GetPointerState()=0
PauseVideo()
SetSpriteVisible(rainbow, 1)

endif

Print( "I said hey!")
Sync()
loop
Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 25th Nov 2014 18:10
I have changed, "PlayVideo()" to "if GetVideoPlaying() = 0 then PlayVideo()". If your mouse is pressed then "PlayVideo()" would be getting called over and over again which would continuously be restarting the video. This is why you were only seeing one frame of the video. By adding "if GetVideoPlaying() = 0" we are making sure that the video is not already playing.

Try this:




Sean

Login to post a reply

Server time is: 2024-11-25 11:44:50
Your offset time is: 2024-11-25 11:44:50