WMPlayer icon indicating copy to clipboard operation
WMPlayer copied to clipboard

播放本地视频,提示视频加载失败

Open yuanweiphone opened this issue 5 years ago • 1 comments

作者,你好 播放本地视频提示The requested URL was not found on this server." UserInfo={NSLocalizedDescription=The requested URL was not found on this server., NSUnderlyingError=0x600003ca97d0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} 但是本地是存在文件的,这是什么原因呢? 代码如下

    let path = Bundle.main.path(forResource: "444", ofType: "mp4")
    let url = URL(fileURLWithPath: path!)
    let urlPath = url.absoluteString.removingPercentEncoding
    
    let playerModel = WMPlayerModel()
    playerModel.title = videoName
    playerModel.videoURL = URL(fileURLWithPath: urlPath!)

    playerView = WMPlayer(model: playerModel)
    playerView.frame = CGRect(x: 170, y: 200, width: SCREEN_WIDTH - 340, height: 400)
    view.addSubview(playerView)
    playerView.play()

yuanweiphone avatar Jun 18 '19 05:06 yuanweiphone

换个mp4的视频测试一下,如果不是视频的原因,估计就是url路径问题。视频播放器确认是支持本地视频的。

zhengwenming avatar Jul 02 '19 06:07 zhengwenming