|
I am having a problem playing a video. Here is my example code
When the program runs, I just get the video controls shown, but a blank video. Some other videos play OK. Any ideas? My iPhone is running 14.0 |
|
I'm not sure you're able to embed YouTube videos like that – IIRC they serve them up in a format iOS doesn't support without special permissions from Apple. Perhaps try a direct MP4 link first and see if that's better. |
|
the problem is that I get the URL from this API call https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY&date=2020-08-31 |
|
|
|
Yes I tried with local m4v files, its showing black screen. Tried mp4 file it shows the video thumbnail but no controls, does not play. A remote url works but not youtube video. I need to play local m4v files. Also how to programmatically play the video in swiftUI and also add flag overlays as this is a test. |
|
|
|
Sure, the |
|
Sorry for the late reply, but Giles Van Gruisen has created a WKWebView YouTube player (https://github.com/gilesvangruisen/Swift-YouTube-Player), which you can utilize in your SwiftUI project following this guide https://medium.com/@mikolukasik/implementing-a-youtube-player-in-swiftui-ff386fdfd1fb by Miko Lukasik |
|
Would it be possible to implement something like this in macOS? If so, how hard would it be to convert it? |
SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until February 9th.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.