xdcomx
xdcomx

Reputation: 163

How to play videos from a Google Drive link?

In my app, I want to play videos from a Google Drive link. I have tried using VideoPlayerController

_controller = VideoPlayerController.network('https://drive.google.com/open?id=xxxxxxxxx'); 

but can't play it. Its shown black and when I played it, nothing seem anything.

Maybe someone can help me. Suggestion really appreciated. Thanks.

Upvotes: 2

Views: 5993

Answers (2)

xdcomx
xdcomx

Reputation: 163

After search around the web, finally found the answer. So, if we want to play video from Google Drive, we must get direct download link from our video. In example, we got this link from our video in google drive 'https://drive.google.com/uc?export=download&id=xxxxxxxx'. And we can put direct download link into :

_controller = VideoPlayerController.network('https://drive.google.com/uc?export=download&id=xxxxxxxx');

Then the video can be play.

Upvotes: 4

Celal TOK
Celal TOK

Reputation: 31

i think you are using 'video_player 0.10.10' library.

It is useful to review the documentation on puv.dev.

If you are using IOS emulators, you should pay attention to this warning

'Warning: The video player is not functional on iOS simulators. An iOS device must be used during development / testing. '

Add the following entry to your Info.plist file, located in /ios/Runner/Info.plist:

<Key> nsapptransportsecurity </ key>
<Dict>
   <Key> nsallowsarbitraryloads </ key>
   <True/>
</ Dict>

Android

Ensure the following permission is present in your Android Manifest file, located in /android/app/src/main/AndroidManifest.xml:

<uses-permission android: name = "android.permission.INTERNET" />

Upvotes: -1

Related Questions