Video on html version

Can I download and play video on the HTML version?

What have you tried so far?

Download from where?

Is this question really, “Does native.newVideo() work for HTML5 buids?”

Answer, “I’m not sure”,  try building the video samples that come with Corona for HTML5.  

Remember, Corona comes with a bunch of sample you can build and try.

If they work then the answer is probably, “Yes.”

I just tried the new video sample and it works for me, so I think downloading the video and playing it from the documents folder should be no problem.

Let me try that!

Tried your suggestion and also below - no good - work on simulators but not HTML5:

media.playVideo( “movie.m4v”, true, onComplete )

HTML5 does have tags for video tho. Is it something you are planning to add?

https://www.w3schools.com/html/tryit.asp?filename=tryhtml5_video_autoplay

That was not my suggestion.  I didn’t mean syntax samples, I meant complete sample apps.

  1. Open up the corona simulator.

  2. Click samples link.

  3. Find the ‘new video’ sample.

  4. Build it for HTML5

  5. Test it.

Done.  It works.  Use that as your example of how to do the work you need.

https://www.youtube.com/watch?v=ZAUzyulgIEY&feature=youtu.be

OK, it works on Chrome & Firefox but not Safari. – should it?

I’ll assume you’re asking all readers and not me, because I don’t know.   I’m just a guy with some answers and experience.  

I suggest you dig into the safari error logs and see if something pops out.  Also I don’t use OS X on a normal basis.

Alternately run the debug version of the app and run it then see what Corona says.

Look in the folder where you built to and load this file in the browser: index-debug.html

Tip:  You can’t just drop the file on your browser.

Instead,

  1. Install python on your machine.

  2. Install SimpleHTTPServer (https://www.pythonforbeginners.com/modules-in-python/how-to-use-simplehttpserver/)

  3. Open a console and cd to the folder where the file sample built to.

  4. rename _index.html to _index.html

  5. rename index-debug.html to index.html

  6. Run SimpleHTTPServer in that folder: python -m SimpleHTTPServer 8080

  7. Open the link http://127.0.0.1:8080 in your browser.

This may or may not be related, but just a heads up that different browsers and operating systems support different codecs for HTML5 video playback, and some browsers impose limitations. For example in your comment above, you referenced an m4v file which isn’t supported by iOS Safari but is by Windows Safari I believe. Additionally, modern versions of both Chrome and Safari won’t autoplay videos that have sound - a fairly recent change.

I’ve no idea whether Corona does some magic to work around these things, but you might find better results with audioless MP4. Presumably you can simultaneously play the audio track separately if need be.

Richard, you are exactly right. I removed the audio from an mp4, uploaded it to a web location, then it worked on Safari.

I also tried playing the same mp4 from the system.ResourceDirectory (and then copying from system.ResourceDirectory to system.DocumentsDirectory) which did not work. Seems there is not a system.DocumentsDirectory for HTML5. I also tried just copying the file into the directory (because I saw in the java console log that it was looking for it there) this made it find the file, but it failed to play, gave error about a “Promise rejection NotSupportedError”.

So I think we have found the answer - Safari won’t play a video with sound in the way Corona is making it play - because it is considered “autoplaying” the video.

And there is something weird about bundling video with app, but that might have been me getting something wrong.

I’ve downloaded files to the system.DocumentsDirectory in HTML5 builds before and then used those files.  So, I’m pretty sure there is a system.DocumentsDirectory.

For example, this old experiment (takes a while to load): https://roaminggamer.github.io/RGDocs/pages/html5_tests/tests/askEd/

When you click the examples (only 3) they are downloaded with their assets and then run.

What have you tried so far?

Download from where?

Is this question really, “Does native.newVideo() work for HTML5 buids?”

Answer, “I’m not sure”,  try building the video samples that come with Corona for HTML5.  

Remember, Corona comes with a bunch of sample you can build and try.

If they work then the answer is probably, “Yes.”

I just tried the new video sample and it works for me, so I think downloading the video and playing it from the documents folder should be no problem.

Let me try that!

Tried your suggestion and also below - no good - work on simulators but not HTML5:

media.playVideo( “movie.m4v”, true, onComplete )

HTML5 does have tags for video tho. Is it something you are planning to add?

https://www.w3schools.com/html/tryit.asp?filename=tryhtml5_video_autoplay

That was not my suggestion.  I didn’t mean syntax samples, I meant complete sample apps.

  1. Open up the corona simulator.

  2. Click samples link.

  3. Find the ‘new video’ sample.

  4. Build it for HTML5

  5. Test it.

Done.  It works.  Use that as your example of how to do the work you need.

https://www.youtube.com/watch?v=ZAUzyulgIEY&feature=youtu.be