openframeworks / openframeworks/openFrameworks

ofVideoPlayer problems when loading URL

Open
#4,662 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

Hi!
I am trying to load a youtube URL -full direction obtained with youtube-dl- with no success using v0.9.0.
v0.8.4 worked fine on some XCode versions (?!) and OS X version.

This is the code I am using:

ofVideoPlayer videoTest;
string videoLink = "<full URL>";
    videoTest.load(videoLink);
    videoTest.play();

These are the errors I got, depending on the XCode version, OF version and OS X version:

MacBook Pro (1):
OF v0.8.4 + 10.9.5 + Xcode 6.2 <ofVideoPlayer::loadMovie(string URL)>
    This one works! Base SDK 10.10, Deployment Target 10.6
OF v0.9.0 + 10.9.5 + Xcode 6.2 <ofVideoPlayer::load(string URL)> Base SDK 10.10, Deployment Target 10.8 (using deployment target 10.6 shows the same error)
    2015-12-10 10:24:45.025 videoTestDebug[10072:2607] An uncaught exception was raised
    2015-12-10 10:24:45.025 videoTestDebug[10072:2607] *** -[AVAssetReader initWithAsset:error:] Cannot initialize an instance of AVAssetReader with an asset at non-local URL 'https://r5---sn-h5q7dne6.googlevideo.com/videoplayback?id=o-AFTgrN_9tjqDhTh7y7fHwmb97X8ra- <…>

2015-12-10 10:24:45.026 videoTestDebug[10072:2607] (
    0   CoreFoundation                      0x00007fff879bb25c __exceptionPreprocess + 172
    1   libobjc.A.dylib                     0x00007fff8e070e75 objc_exception_throw + 43
    2   AVFoundation                        0x00007fff89159bdd -[AVWeakKeyValueObserverProxy initWithWeakReferenceToObserver:] + 0
    3   AVFoundation                        0x00007fff891926f0 +[AVAssetReader assetReaderWithAsset:error:] + 64
    4   videoTestDebug                      0x00000001003eab06 -[ofAVFoundationVideoPlayer createAssetReaderWithTimeRange:] + 225
    5   videoTestDebug                      0x00000001003e97be __47-[ofAVFoundationVideoPlayer loadWithURL:async:]_block_invoke_2 + 873
    6   libdispatch.dylib                   0x0000000100d4632d _dispatch_call_block_and_release + 12
    7   libdispatch.dylib                   0x0000000100d42925 _dispatch_client_callout + 8
    8   libdispatch.dylib                   0x0000000100d4552c _dispatch_queue_drain + 1108
    9   libdispatch.dylib                   0x0000000100d46c04 _dispatch_queue_invoke + 118
    10  libdispatch.dylib                   0x0000000100d44a37 _dispatch_root_queue_drain + 83
    11  libdispatch.dylib                   0x0000000100d462e6 _dispatch_worker_thread2 + 52
    12  libsystem_pthread.dylib             0x00007fff8e391ef8 _pthread_wqthread + 314
    13  libsystem_pthread.dylib             0x00007fff8e394fb9 start_wqthread + 13
)
2015-12-10 10:24:45.043 videoTestDebug[10072:2607] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVAssetReader initWithAsset:error:] Cannot initialize an instance of AVAssetReader with an asset at non-local URL 'https://r5---sn-h5q7dne6.googlevideo.com/videoplayback?id=o-

MacBook Pro (2):
OF v0.8.4 + 10.11.1 + Xcode 7.1.1 <ofVideoPlayer::loadMovie(string URL)>
    This one works! Base SDK is 10.11, Deployment Target is 10.6
OF v0.9.0 + 10.9.5 + Xcode 6.2 <ofVideoPlayer::load(string URL)>Base SDK is 10.11, Deployment Target is 10.6
2015-12-10 11:02:36.338 streamVideoDebug[4752:315208] assetReader: error during initialisation: Operation Stopped
2015-12-10 11:02:36.338 streamVideoDebug[4752:315208] problem with creating asset reader.

iMac:
OF v0.8.4 + 10.11.2 + XCode 7.1 <ofVideoPlayer::loadMovie(string URL)>
    [ error ] ofQuickTimePlayer: createMovieFromPath(): couldn't load movie, FSPathMakeRef failed: OSErr -43
    [ error ] ofQuickTimePlayer: play(): movie not loaded

OF v0.9.0 + 10.11.2 + XCode 7.1 <ofVideoPlayer::load(string URL), 64-bit, same on 32-bit>
    2015-12-10 09:53:36.807 videoTestDebug[1177:231008] assetReader: error during initialisation: Operation Stopped
    2015-12-10 09:53:36.808 videoTestDebug[1177:231008] problem with creating asset reader.

OF v0.8.4 + 10.11.2 + XCode 7.2 (same code than Xcode 7.1)
    [ error ] ofQuickTimePlayer: createMovieFromPath(): couldn't load movie, FSPathMakeRef failed: OSErr -43
    [ error ] ofQuickTimePlayer: play(): movie not loaded

OF v0.9.0 + 10.11.2 + XCode 7.2 (same code than Xcode 7.1), 64-bit, same on 32-bit>
    2015-12-10 09:53:36.807 videoTestDebug[1177:231008] assetReader: error during initialisation: Operation Stopped
    2015-12-10 09:53:36.808 videoTestDebug[1177:231008] problem with creating asset reader.

I checked all that I could here in this openFrameWorks thread:
https://forum.openframeworks.cc/t/ofvideoplayer-load-and-loadmovie-problems-when-streaming/21636/8
Up to my knowledge, it looks like the problem happens in ofAVFoundationVideoPlayer.m:

AVURLAsset* asset = [AVURLAsset URLAssetWithURL:url options:options];

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in ofAVFoundationVideoPlayer.m at AVURLAsset URLAssetWithURL:options: and reproduce the reported load/play behavior with the full youtube-dl URL across the listed openFrameworks and macOS versions. Compare the v0.8.4 and v0.9.0 behavior and the AVAssetReader errors; done means the URL loads and plays without the reported non-local URL or asset-reader failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, macos
Domain
audio-video-rtc, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.