Stencyl Video Behavior

niccosw

  • Posts: 91
This behavior has been updated. Use "Video Actor" instead.

http://community.stencyl.com/index.php/topic,2234.0.html

Quote
This behavior introduces video streaming into Stencyl. A single behavior file is attached to a scene with two attributes:
  • VideoURL - This can be local or on the web. File should be FLV, MP4 or other highly compressed format.
  • Scene to exit to - Another scene in the game that can be exited to when the video ends.

Hitting and releasing the SPACE bar will end the video. There is no crossdomain security implemented so it will not work with standard game portals. Use only on a single server or local file access.

Since video is played on a stage above the game, it is not effected by most game wide behaviors (pause, volume control, replay, etc) There may be issues with netstreams and/or connections not closing properly leading to memory leaks. Let me know if it slows your game down too much.

« Last Edit: July 23, 2011, 05:10:08 pm by niccosw »

Rob

  • *
  • Posts: 1268
Nice. Can you attach a game to this behavior so that we can hit Play Now before downloading it to see how it works?

Look for my behavior called Teleporting and hit play now and see what I mean. Thanks.
GOLDEN RULE #1 : SAVE YOUR GAMES FREQUENTLY
IOS/XCODE DEBUGGING
http://www.stencyl.com/help/view/xcode-ios-troubleshoot/
WATCH STENCYLWORKS VIDEO TUTORIAL BY SUNRISEKINGDOM
http://www.youtube.com/watch?v=KDfRfjzr9j4&feature=channel_video_title

niccosw

  • Posts: 91
Hmmm. Seems like it's working on portals after all. I assumed it required crossdomain to be set up but I guess not.

Here you go: http://www.stencyl.com/game/play/3653 [UPDATED]

The video is streaming from: http://adobe.edgeboss.net/download/adobe/adobetv/gotoandlearn/flixel1.mp4

« Last Edit: June 18, 2011, 08:14:05 pm by niccosw »

Rob

  • *
  • Posts: 1268
Very nice. After I hit enter to leave the video scene, do I expect to see some game or it's just blank for now? If not, I suggest just some placeholder graphics. The Play Now feature on Forge also worked nicely.
GOLDEN RULE #1 : SAVE YOUR GAMES FREQUENTLY
IOS/XCODE DEBUGGING
http://www.stencyl.com/help/view/xcode-ios-troubleshoot/
WATCH STENCYLWORKS VIDEO TUTORIAL BY SUNRISEKINGDOM
http://www.youtube.com/watch?v=KDfRfjzr9j4&feature=channel_video_title

Jon

  • *
  • Posts: 17529
I'm going to have some of our team eval this and look into integrating this as an official block since folks have been clamoring for this, and this seems pretty straightforward.

niccosw

  • Posts: 91
Rob: OK, I posted a new demo game with the behavior. It goes full screen on start-up and I laid down some tiles and sprites on the exit page to show that it returns to a standard game level after hitting the space bar.

Jon: Thanks! Let me know if I can be of any help.

Also: Is it possible to create completely transparent Stencyl games / scenes? If so, we may be able to use StageVideo layer beneath the DisplayList and use the GPU for streaming. I'll try at my end.

NM. It looks like Stencyl is using Flex SDK 4.0 Flash Player 10.0 which doesn't support StageVideo.

« Last Edit: June 18, 2011, 09:10:56 pm by niccosw »

Rob

  • *
  • Posts: 1268
Rob: OK, I posted a new demo game with the behavior. It goes full screen on start-up and I laid down some tiles and sprites on the exit page to show that it returns to a standard game level after hitting the space bar.


Thanks. Looking good. I just wish the video does not extend all the way outside the screen boundary on the right. But the important thing here is that it worked.
GOLDEN RULE #1 : SAVE YOUR GAMES FREQUENTLY
IOS/XCODE DEBUGGING
http://www.stencyl.com/help/view/xcode-ios-troubleshoot/
WATCH STENCYLWORKS VIDEO TUTORIAL BY SUNRISEKINGDOM
http://www.youtube.com/watch?v=KDfRfjzr9j4&feature=channel_video_title

Jon

  • *
  • Posts: 17529
Rob: OK, I posted a new demo game with the behavior. It goes full screen on start-up and I laid down some tiles and sprites on the exit page to show that it returns to a standard game level after hitting the space bar.

Jon: Thanks! Let me know if I can be of any help.

Also: Is it possible to create completely transparent Stencyl games / scenes? If so, we may be able to use StageVideo layer beneath the DisplayList and use the GPU for streaming. I'll try at my end.

NM. It looks like Stencyl is using Flex SDK 4.0 Flash Player 10.0 which doesn't support StageVideo.

We ship with 10.2, pending an update to 10.3 (which you could grab and test for yourself off Adobe.com if that helps)

I don't actually recall exactly which Flex SDK version we've adopted, but I believe it's 3.5 or 4. We did strip off a lot of stuff that wasn't relevant to games to bring down the size.

niccosw

  • Posts: 91
My mistake. I guess it would be possible, but we'd need access to the necessary Flex 4.5 classes.

Hi, First of all, thanks for developing this behavior  :D

I intend to play local video files, and I was wondering, where I'm supposed to place them so I can access them with the game? (It would be a wonderful thing to be able to use a relative path).

Darkhog

  • Posts: 1243
As a matter of fact it actually work crosssite (the video in demo is streamed from adobe server, while swf is on stencyl's), so you just need to upload flv or mp4 to any file hosting which gives static, public link to file (e.g. dropbox) and you can stream from it.

There are no impossible things. There is only lack of skills.
Don't click this if your computer has less than 641 kilobytes of RAM.
Stencyl stencyling stencylish stencylers :D

As a matter of fact it actually work crosssite (the video in demo is streamed from adobe server, while swf is on stencyl's), so you just need to upload flv or mp4 to any file hosting which gives static, public link to file (e.g. dropbox) and you can stream from it.

I know, but I'm at a loss on how to do it locally, using a relative path.

niccosw

  • Posts: 91
If you want to test using a relative path, you should place the video files in "StencylWorks\plaf\flash". Then you would call them by name like "myVideo.flv".

I often create a separate folder called "assets" in the "flash" folder. Then I call: "assets/myVideo.flv". If I placed the folder higher in the hierarchy, such as "StencylWorks\assets" then I would use "../../assets/myVideo.flv".

Does that answer your question?


Yes thanks very much  :D (i must be the only weirdo that is not interested in flash for web deployment :-p)

niccosw

  • Posts: 91
I have noticed that when playing MP4 files, older MPEG-4 video does not work but H.264/MPEG-4 Part 10 (aka AVC) encoded video works fine.

If you are having trouble playing an MP4 file, try re-encoding it to H.264.