Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot play video saved into phone storage #94

Open
waleedmakarem opened this issue Jan 7, 2021 · 2 comments
Open

cannot play video saved into phone storage #94

waleedmakarem opened this issue Jan 7, 2021 · 2 comments

Comments

@waleedmakarem
Copy link

Dear sir,
Thanks so much for the Ince library.
Currently I am trying too play mp4 files that is saved into phone storage. I cannot run it. My code is :

let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
let documentsDirectory = paths[0]
print(documentsDirectory)

    let path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] as String
       let url = NSURL(fileURLWithPath: path)
       if let pathComponent = url.appendingPathComponent("water.mp4") {
           let filePath = pathComponent.path
           let fileManager = FileManager.default
           if fileManager.fileExists(atPath: filePath) {
               print("FILE AVAILABLE")
            let url = URL(string: filePath)!
            videoBackground1.play(view: view1, url: url, darkness: 0.1)
            
           } else {
               print("FILE NOT AVAILABLE")
           }
       } else {
           print("FILE PATH NOT AVAILABLE")
       }

below is debug code:FILE AVAILABLE
2021-01-07 22:48:54.253683+0200 yarab[18271:807739] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600003c5d3e0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
2021-01-07 22:48:54.299434+0200 yarab[18271:807835] NSURLConnection finished with error - code -1002

@dingwilson
Copy link
Owner

dingwilson commented Jan 9, 2021

Hey @waleedmakarem! Thanks for using SwiftVideoBackground! It looks like the url is unsupported. See:

https://developer.apple.com/documentation/foundation/1508628-url_loading_system_error_codes/nsurlerrorunsupportedurl

@gromozekapp
Copy link

Thank you, everything works in 2024 both outside and inside:

    try? VideoBackground.shared.play(view: view, videoName: "myVideo", videoType: "mp4")     
       /* or from URL */
    guard let url = Bundle.main.url(forResource: "VFYD8043", withExtension: "mp4") else {return}
    //let url = URL(string: "https://videos.pond5.com/holographic-background-purple-pink-blue-footage-182330759_main_xxl.mp4")
    VideoBackground.shared.play(view: view, url: url)

but have message from Target Output:

2024-02-28 11:38:05.455243+0200 Lecture21-Cocoapods[2924:7394914] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600003fb8580> F8BB1C28-BAE8-11D6-9C31-00039315CD46

what it's mean?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants