Page 1 of 1

Playback of MP4 files

Posted: Thu Apr 16, 2015 8:34 pm
by HauntedMansion
The App Store description lists playback of MP4 files as a feature, but I can't find any reference to them in the help files or on this forum.

How do you do this?

Re: Playback of MP4 files

Posted: Thu Apr 16, 2015 8:47 pm
by Mr. Kibernetik
MP4 files can be controlled and played with BROWSER object.
You can check "Motion Detector" sample program in Interactive Interface section - it records from camera and plays back MP4 files (which are automatically recorded when motion in front of camera is detected).

Re: Playback of MP4 files

Posted: Thu Apr 16, 2015 8:49 pm
by Mr. Kibernetik
On this Forum you can check for example this: viewtopic.php?f=21&t=699 and this: viewtopic.php?f=21&t=706

Re: Playback of MP4 files

Posted: Fri Apr 17, 2015 7:45 pm
by Operator
Something like this:


REM video mp4 run test
REM video out of: http://www.w3schools.com/html/html5_video.asp
REM video into smart basic using dropbox

scr_w = screen_width()
scr_h = screen_height()
BROWSER "test" AT 0,0 SIZE scr_w, scr_h
text$ = "<video controls><source src=""video/big_buck_bunny.mp4""></video>"
BROWSER "test" TEXT text$

Re: Playback of MP4 files

Posted: Fri Apr 17, 2015 11:08 pm
by HauntedMansion
Thank you so much, that's exactly what I needed!

Is the embedded browser compatible with all the HTML <video> commands?

Re: Playback of MP4 files

Posted: Sat Apr 18, 2015 2:56 am
by Mr. Kibernetik
The embedded browser is equivalent to Safari browser on iOS.

Re: Playback of MP4 files

Posted: Sun Apr 19, 2015 4:05 am
by HauntedMansion
Thanks for the help, I'm making progress and have videos playing.

However, I'm confused on resizing them. SET BROWSERS NORMAL seems to work fine, but whenever I use SET BROWSERS SCALED, the video shrinks to either 1/4 or 1/9 the browser window size no matter the original size of the video or the browser window.

I'd like to be able to set the size of the browser window and have the video automatically scale to fill the window. No luck so far! :D

I used the following code to try to display a 320x240 video. SET BROWSERS NORMAL nearly fills the browser as I'd expect, but setting it to SCALED shows it as a small video in the upper left 1/9 of the browser window...

SET BROWSERS SCALED
BROWSER "test" AT 100,100 SIZE 335,255
text$ = "<video><source src=""Video\TestVideo.mp4"" width=""320"" height=""240""></video>"
BROWSER "test" TEXT text$
video=browser_text$("test","var myVideo = document.getElementsByTagName('video')[0];myVideo.play();")

Re: Playback of MP4 files

Posted: Sun Apr 19, 2015 4:48 am
by Mr. Kibernetik
So why do you want to use BROWSERS SCALED if NORMAL is working fine?

With SCALED option you will not get desired size anyway - browser content is scaled.

Re: Playback of MP4 files

Posted: Sun Apr 19, 2015 3:19 pm
by HauntedMansion
:D

Because I want to show several different videos of unknown and varying sizes starting one after the other in the same browser window.

I guess I'm simply asking for clarification on how the scaling works. After several different combinations of window sizes and videos, I can't figure it out.

Re: Playback of MP4 files

Posted: Sun Apr 19, 2015 3:27 pm
by Mr. Kibernetik
Scaling is meant to fit webpage contents in the browser's window.