Hi, Dinesh,

Considering you’ve got a new Flutter web project set up you’ll work with an index.html looking like this (it’s located in the web folder inside the root of your project):

You need to do the following edits:

Then in your code you’ll make a call to the playVideoInJWPlayer JS function we defined passing the url:

void playVideo() {
String url = "http://commondatastorage.googleapis.com/gtv-videos- bucket/sample/BigBuckBunny.mp4";
js.context.callMethod(playVideoInJWPlayer, [url]);
}

You could modify the JS function to accept the width and height as parameters to get more flexibility out of it.

The JS function becomes:

And the Dart function:

If the JS libraries for JWPlayer are loaded correctly and you trigger the playVideo() function then everything should work fine.

Good luck!

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store