英文:
How to play video from Google Drive in SwiftUI project?
问题
I have a JSON file stored on a server that contains a list of lessons. Each lesson has a Google Drive link to a video. I'm currently building a SwiftUI video player, and I'm looking for assistance on how to play the video directly from the Google Drive link.
Here's an example of the Google Drive link format:
"https://drive.google.com/file/d/xxxxxxxxxxx/view?usp=share_link"
I'm seeking guidance on how to extract the video URL from the Google Drive link and play it using the SwiftUI video player.
When I'm trying to implement a simple player, it's not working. I've also tried to use a direct link, like that: https://drive.google.com/uc?export=download&id=xxxxxxxx, it's not working either. There was also an old method from here, but it didn't work too. Is it even possible to stream and play in AVPlayer from Google Drive?
Any help would be appreciated. Thank you!
英文:
I have a JSON file stored on a server that contains a list of lessons. Each lesson has a Google Drive link to a video. I'm currently building a SwiftUI video player, and I'm looking for assistance on how to play the video directly from the Google Drive link.
Here's an example of the Google Drive link format:
"https://drive.google.com/file/d/xxxxxxxxxxx/view?usp=share_link"
I'm seeking guidance on how to extract the video URL from the Google Drive link and play it using the SwiftUI video player.
When I'm trying to implement a simple player, it's not working. I've also tried to use direct link, like that: https://drive.google.com/uc?export=download&id=xxxxxxxx, it's not working either. There was also an old method from here, but it didn't work too. Is it even possible to stream and play in AVPlayer from Google Drive?
Any help would be appreciated. Thank you!
答案1
得分: 1
我可以建议您一个替代方案,即在您的SwiftUI应用程序中嵌入YouTube。为此,您可以利用WebViewContainer来嵌入YouTube视频层到您的应用程序中。以下是一个您可以参考的资源链接:https://blog.devgenius.io/embedded-youtube-videos-in-swiftui-900d3a0e80d4
英文:
I can suggest you an alternative solution which is to embed youtube in your SwiftUI app. For that you can utilize WebViewContainer to embed youtube video layer in you app. Here is a resource you may follow. https://blog.devgenius.io/embedded-youtube-videos-in-swiftui-900d3a0e80d4
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论