media.playVideo() in api corona

Hello, 

I have a short movie clip in both formats of mp4 and m4v. 

I have used the following code to play the video when the play button is tapped, however, nothing happens. 

I have tried the media.playVideo() without the button so it will automatically start once the scene is shown, however; nothing happens. 

My computer is a mini apple Mac mini desktop, and the simulator is set to Apple 5. 

local Button local function myVideo() media.playVideo( "lift.m4v", true, onComplete ) end ---- SCENE: SHOW (EVENT) Button = display.newImageRect("playbtn.png", 100, 100 ) Button.x = display.contentWidth/2 Button.y = display.contentHeight/2 Button:addEventListener("tap", myVideo)

Did you double check the docs?

https://docs.coronalabs.com/daily/api/library/media/playVideo.html#gotchas

If that isn’t clear… it means you can’t test this in the simulator.  

You must test it on a device or an emulated device and only if the emulated device supports the API.

I believe you can test this with the emulated devices on Mac.

One last note, the simulator is not an emulator.  I’m talking about the emulated devices available via xcode.

Thanks for the instructions.

Had already read the api guideline. 

How can I test the Lua code on the emulated devices available in xcode? 

Does it mean I have to write the code in Objective C or Swift before I test it? (sorry in advance if this is a dumb question)

When you build your app for iOS (must be done with Corona simulator on a mac), you’ll see these options:

  • copy to device
  • open in xcode iOS simulator (choose this)
  • send to app store
  • show in finder
  • do nothing.

Note: IMHO, the second choice should really read: “open in xcode ios emulator”, but whatever.  That is the one you want.

Thank you!

Keeping the Corona Simulator separate from the Xcode simulator is a challenging bit of language artistry. I kinda like calling it emulator, but that’s unfortunately not what Apple calls it. 

Rob

Did you double check the docs?

https://docs.coronalabs.com/daily/api/library/media/playVideo.html#gotchas

If that isn’t clear… it means you can’t test this in the simulator.  

You must test it on a device or an emulated device and only if the emulated device supports the API.

I believe you can test this with the emulated devices on Mac.

One last note, the simulator is not an emulator.  I’m talking about the emulated devices available via xcode.

Thanks for the instructions.

Had already read the api guideline. 

How can I test the Lua code on the emulated devices available in xcode? 

Does it mean I have to write the code in Objective C or Swift before I test it? (sorry in advance if this is a dumb question)

When you build your app for iOS (must be done with Corona simulator on a mac), you’ll see these options:

  • copy to device
  • open in xcode iOS simulator (choose this)
  • send to app store
  • show in finder
  • do nothing.

Note: IMHO, the second choice should really read: “open in xcode ios emulator”, but whatever.  That is the one you want.

Thank you!

Keeping the Corona Simulator separate from the Xcode simulator is a challenging bit of language artistry. I kinda like calling it emulator, but that’s unfortunately not what Apple calls it. 

Rob