ofVideoPlayer.load and .loadMovie problems when streaming

Hi!
I am experiencing a weird problem when trying to load a stream video.
I am using this youtube link:

https://r1---sn-h5q7dnel.googlevideo.com/videoplayback?ipbits=0&signature=26F81A1ED1655807862D51590AE28E1DE4D79DBA.4FBD450DD8C5D9973F9D263DDEAC92C1087D768A&itag=18&nh=IgpwcjAyLm1hZDAxKgkxMjcuMC4wLjE&ratebypass=yes&dur=49.249&expire=1449076879&lmt=1449033247392868&pl=16&ip=79.150.4.33&sparams=dur%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&fexp=9407706%2C9408494%2C9408710%2C9414703%2C9416126%2C9417260%2C9417683%2C9419354%2C9419892%2C9420452%2C9422596%2C9422618%2C9422954%2C9423662%2C9424135%2C9424768%2C9424965%2C9425308&id=o-AGf6gsJAihtCXLbD8uFlhCJLNwf61ol6M85hhu1D6u2w&upn=Hp0sxprX2EQ&initcwndbps=2215000&key=yt6&requiressl=yes&sver=3&mime=video%2Fmp4&mm=31&mn=sn-h5q7dnel&ms=au&mt=1449055192&mv=m&source=youtube

Using v0.8.4 and video.loadMovie(link) works OK but v0.9.0 video.load(link) throws this error:

assetReader: error during initialisation: Operation Stopped
problem with creating asset reader.

Any idea?
Thanks a lot!
Diego

which platform is this on? windows, osx, linux?

Hi Dom!
Thanks for answering. Sorry, I missed that piece of info, quite relevant.
I am using osx 10.11. I had to change Deployment Target under XCode to something greater than 10.6 -that was the first error that I had-
After that, I had the errors I printed in the first post.

Thanks a lot!
D!

Attending to this:
https://developer.apple.com/library/prerelease/ios/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/02_Playback.html
Looks like you need to call specific constructor when using a URL:

If you simply want to play a live stream, you can take a shortcut and create a player directly using the URL use the following code:

self.player = [AVPlayer playerWithURL:<#Live stream URL#>];
[player addObserver:self forKeyPath:@“status” options:0 context:&PlayerStatusContext];
Is this built on OFv0.9? I have checked the ofAVFoundationVideoPlayer.h file and there is a reference to loadWithURL and looking the .m makes me think about the Option passed, but that starts to get fuzzy for my -lack of-knowledge :frowning:

Load from URL is built in. check here:

or here:

both have options for streaming

Thanks Dom!
I will give it a try tomorrow morning together with the async load! I will let you know.

I just can not make it work :frowning:
videoPlayer of AVFoundation is protected…
I am using the version from Download insteadof github, may that be the issue?
Also, I can’t use ofAVFoundationVideoPlayer but ofAVFoundationPlayer.
Have you tried the link I gave in the first post with a ofVideoPlayer object and it .load() method?

So, another try!
This is what I have tested:
I used youtube-dl to get the link to the last Star Wars trailer -my first link is not working anymore, I have noticed it is IP dependent-

youtube-dl -g https://www.youtube.com/watch?v=sGbxmsDFVnE

So I have the actual link

Then, I use this code:

string link = “{the_link_youtube-dl_gave}”;
ofVideoPlayer player;
player.load(link);
player.play();

Right after .load(), I have this error:

2015-12-09 15:44:25.073 videoTestDebug[1236:765100] assetReader: error during initialisation: Operation Stopped
2015-12-09 15:44:25.074 videoTestDebug[1236:765100] problem with creating asset reader.

Can anybody replicate this code with OF v0.9.0? Using that link or any other, I am open to any suggestion. I just can’t find where the problem is.
I had no problem with loadVideo() in 0.8, but I want to use asynch load. I can use the AVFoundation add on
Thanks!
D!

Hi again!
I am also having problems with the v0.8.4 code depending on my XCode version and OSX version. I am opening an issue in github.
I will come back when I have more news!

Hi again!
No luck so far :frowning: I posted an issue in github, but I am finding this terrible difficult. Has anybody tried loading a URL with v0.9.0?

i tried your code on OF 0.8.4, OS X 10.10 and Xcode 6.4 and it works fine.
the same code on OF 0.9.0 does throw this error message. But i don’t know why.

[09:51:59.845] FigLimitedDiskCacheProvider_CopyProperty signalled err=-12784 (kFigBaseObjectError_PropertyNotFound) (no such property) at /SourceCache/CoreMedia/CoreMedia-1562.240/Prototypes/FigByteStreamPrototypes/FigLimitedDiskCacheProvider.c line 947 2015-12-21 09:51:59.849 testVideo8[1830:112822] assetReader: error during initialisation: Operation Stopped 2015-12-21 09:51:59.849 testVideo8[1830:112822] problem with creating asset reader.

Thanks buddy. Now at least I know is not my fault…
Let’s hope some one can throw some light…
Arturo suggested it may have to do with the delay time from opening until the stream is properly ready… but I have no clue how to chek it…

I tried a youtube link and a video hosted on a local server, but I get the same error as you. I hope someone can shine a light on this :confused:

Thanks a lot for giving it a try.
I posted an issue in github. Maybe you could insist in there?
Thanks again!
D!

Hi!
I found this:
https://github.com/openframeworks/openFrameworks/issues/1741
but I don’t know how to continue :frowning:
Also, there are two different implementation of AVFoundation player: AVFoundationPlayer and AVFoundationVideoPlayer
Does anybody know the difference?
Best!
D!

Hi again and happy new year!
I have found no solution yet. Neither github issue seems to be answered. Anybody has any clue?
Best!
D!

No news, bad news?

@dmelladom in 0.9.0 we switched to a new video player api since the old one is being deprecated by apple. Some things like streaming might have not been implemented yet so this needs to be implemented. It’s not a simple fix and someone has to find the time to work on it. Also the issue in github is milestoned for 0.10 and we are working right now on releasing 0.9.1 so it probably won’t happen at least until after 0.9.1 is ready.

If you or someone else want to look into it, a pull request with the implementation or any clue in the issue about what needs to be done for this to work would be really helpful.

Hi arturo,
I totally understand the situation. I won’t insist any further. I did not noticed it was milestone for 0.10, sorry for that.
I am more than pleased to help, but I am not sure where to begin. If somebody could provide a direction on the topic, I will start researching from there. At the point where the new video api begins, the code get too obscure for me.
Thanks a lot for your support and help with all these, I really appreciate it.
Best,
Diego

maybe start here:

as a starter maybe try to make your own addon with an objective-c wrapper that allows you to get videos via the OS X AVFoundation and AVKit.

i recently needed to get the location IDs from connected cameras and didn’t see away for ofVideoGrabber to supply that.
So pull some code out of the base OF code and combined it with some object-c code. it’s quite a hack but it works.