Dudu
Dudu

Reputation: 1

Embedding Dailymotion Videos in a Flutter App: Is it Possible and Good Practice?

I am trying to find a way to include Dailymotion videos in my Flutter app. The Dailymotion API has SDKs for embedding videos in native Android and iOS apps, but I cannot find a solution for Dart. Can I use these SDKs in Flutter and is it considered a good practice? Are there any potential issues with this approach?

daily motion API reference: https://developers.dailymotion.com/player#embed-mobile

I attempted to include videos by using the current link of the video but the link keeps changing frequently.

Upvotes: 0

Views: 817

Answers (1)

Shubham Bansal
Shubham Bansal

Reputation: 21

Try this way

    Container(
  padding: EdgeInsets.all(10.0),
  width: screenSize.width - 30,
  height: screenSize.width * 3 / 5,
  margin: const EdgeInsets.all(1),
  child: Html(
    data: '<html><body>' +
        '<iframe id="player" frameborder="0" allowfullscreen="true" allow="autoplay" title="Dailymotion video player" width="100%" height="100%" src="https://www.dailymotion.com/embed/video/k6hWB8B4bz4cnmaQArJ?api=postMessage&amp;id=player&amp;mute=false&amp;origin=https%3A%2F%2Fqualif.securite-routiere.gouv.fr&amp;queue-enable=false"></iframe>' +
        '</body></html>',
  ),
)

In the above code the daily motion video id is

k6hWB8B4bz4cnmaQArJ

You can change it with your id.

I used the package "video_player" and it is working fine. To check more details you can visit the below URL: https://pub.dev/packages/video_player

Upvotes: 0

Related Questions