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

There is no way to get youtube video buffering state #40

Closed
dyorgio opened this issue May 1, 2012 · 13 comments
Closed

There is no way to get youtube video buffering state #40

dyorgio opened this issue May 1, 2012 · 13 comments

Comments

@dyorgio
Copy link

dyorgio commented May 1, 2012

Hello caprica :),

I'm trying to create a good youtube player with jvlc, but I couldn't find a way to create a graphic buffer state
for buffering event.

Is there some VLC API that can help us? :D

My idea is make a progress bar with 2 levels:

  1. Media download state. (%)
  2. Media position. (>)

totalsize (=)

Like youtube player... ex: |>>>>>>%%%%%============|

@caprica
Copy link
Owner

caprica commented May 1, 2012

I have seen the media player listener "buffering" event working in recent versions of vlc. However, I do not know if it is generated for ALL types of media, and in particular I do not know if it is sent for YouTube or similar media.

What I do know is that vlcj already gives you every event that vlc fires.

@caprica
Copy link
Owner

caprica commented May 1, 2012

I tested the vlcj YouTubePlayer example. It does indeed fire "buffering" events. In fact, it fires multiple buffering events until buffering is finished before you get a playing event.

However, at the moment you can not get a percentage complete indicator via this event.

The good news is that this percentage value is available, it's just not exposed via vlcj.

I added it and it appears to work, I get this debug output:

Buffering 0.0
Buffering 0.0
Buffering 31.0
Buffering 61.0
Buffering 92.0
Buffering 100.0

I will commit my fix soon and it will be included in the next release of vlcj.

@ghost ghost assigned caprica May 1, 2012
@caprica
Copy link
Owner

caprica commented May 1, 2012

Commited 6aadcb3.

@dyorgio
Copy link
Author

dyorgio commented May 1, 2012

Very good Mark!

If you want a beta-tester... :)

Thank you very much for maintain this wonderful API

@caprica
Copy link
Owner

caprica commented May 1, 2012

It's committed now, you can either get the code yourself from github, or you can wait until I upload a new vlcj 2.1.0-SNAPSHOT to the Caprica maven repository (soon).

@caprica
Copy link
Owner

caprica commented May 1, 2012

Closing this, you can re-open it if you find it does not work.

@caprica caprica closed this as completed May 1, 2012
@caprica
Copy link
Owner

caprica commented May 1, 2012

Uploaded new 2.1.0-SNAPSHOT to the maven repository.

@dyorgio
Copy link
Author

dyorgio commented May 1, 2012

The event is about partials buffering..
For example, I put the Iron man 2 trailer to run in fullhd and have this output:

       _       _
__   _| | ___ (_)
\ \ / / |/ __|| |
 \ V /| | (__ | |
  \_/ |_|\___|/ | 2.1.0
            |__/  www.capricasoftware.co.uk

VLCJ is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

VLCJ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with VLCJ.  If not, see <http://www.gnu.org/licenses/>.

Copyright 2009, 2010, 2011, 2012 Caprica Software Limited.

buffering:0.0
seekable:0
lenght:0
ERROR
lenght:0
buffering:0.0
seekable:0
lenght:0
ERROR
lenght:0
SUB:0
buffering:0.0
seekable:1
lenght:149182
buffering:0.0
...
buffering:96.0
Fontconfig error: Cannot load default config file
buffering:96.0
buffering:96.0
buffering:96.0
buffering:96.0
buffering:96.0
buffering:96.0
buffering:100.0
Fontconfig error: Cannot load default config file
Fontconfig error: Cannot load default config file
[0x7fc741caab50] main vout display error: option macosx-video-autoresize does not exist
2012-05-01 18:58:42.333 java[418:407] -[CocoaAppWindow isFullscreen]: unrecognized selector sent to instance 0x7fc743144c50
2012-05-01 18:58:42.334 java[418:407] -[CocoaAppWindow isFullscreen]: unrecognized selector sent to instance 0x7fc743144c50
2012-05-01 18:58:42.430 java[418:407] (
    0   CoreFoundation                      0x00007fff8bce4fc6 __exceptionPreprocess + 198
    1   libobjc.A.dylib                     0x00007fff92897d5e objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff8bd712ae -[NSObject doesNotRecognizeSelector:] + 190
    3   CoreFoundation                      0x00007fff8bcd1e73 ___forwarding___ + 371
    4   CoreFoundation                      0x00007fff8bcd1c88 _CF_forwarding_prep_0 + 232
    5   libvout_macosx_plugin.dylib         0x000000012325ccbd -[VLCOpenGLVideoView setWindowFrameWithValue:] + 45
    6   Foundation                          0x00007fff881b5d94 __NSThreadPerformPerform + 214
    7   CoreFoundation                      0x00007fff8bc536e1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    8   CoreFoundation                      0x00007fff8bc52f4d __CFRunLoopDoSources0 + 253
    9   CoreFoundation                      0x00007fff8bc79d39 __CFRunLoopRun + 905
    10  CoreFoundation                      0x00007fff8bc79676 CFRunLoopRunSpecific + 230
    11  HIToolbox                           0x00007fff9377731f RunCurrentEventLoopInMode + 277
    12  HIToolbox                           0x00007fff9377e5c9 ReceiveNextEventCommon + 355
    13  HIToolbox                           0x00007fff9377e456 BlockUntilNextEventMatchingListInMode + 62
    14  AppKit                              0x00007fff9296ef5d _DPSNextEvent + 659
    15  AppKit                              0x00007fff9296e861 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
    16  libawt.jnilib                       0x00000001187140a5 -[NSApplicationAWT nextEventMatchingMask:untilDate:inMode:dequeue:] + 124
    17  AppKit                              0x00007fff9296b19d -[NSApplication run] + 470
    18  libawt.jnilib                       0x00000001186c0674 +[AWTStarter startAWT:] + 1495
    19  libawt.jnilib                       0x00000001186bffee -[CPerformer perform] + 93
    20  CoreFoundation                      0x00007fff8bcd475d -[NSObject performSelector:withObject:] + 61
    21  Foundation                          0x00007fff881b5d94 __NSThreadPerformPerform + 214
    22  CoreFoundation                      0x00007fff8bc536e1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    23  CoreFoundation                      0x00007fff8bc52f4d __CFRunLoopDoSources0 + 253
    24  CoreFoundation                      0x00007fff8bc79d39 __CFRunLoopRun + 905
    25  CoreFoundation                      0x00007fff8bc79676 CFRunLoopRunSpecific + 230
    26  java                                0x000000010f4a0843 java + 18499
    27  java                                0x000000010f4a029a java + 17050
    28  java                                0x000000010f49da98 java + 6808
)
[0x7fc7435a60f0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 1000 ms)
[0x7fc7435a60f0] main input error: ES_OUT_RESET_PCR called
buffering:0.0
...
buffering:93.0
buffering:96.0
buffering:100.0
[0x7fc7435a60f0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 1028 ms)
[0x7fc7435a60f0] main input error: ES_OUT_RESET_PCR called
buffering:0.0
...
buffering:96.0
buffering:98.0
buffering:100.0

Every time that the movie stops "buffering:0.0" appears on console.
Maybe I could use this information in union with "downloaded bytes" + "buffer size in bytes",
but this put me on starts again :(, vlcj have this informations exposed?

@caprica
Copy link
Owner

caprica commented May 2, 2012

I don't understand your expectation with this.

The buffering event is fired any time vlc is buffering so it would seem correct to me.

Maybe you want to know how much of the total video is buffered, and that is not exposed through the libvlc API as far as I can tell.

@dyorgio
Copy link
Author

dyorgio commented May 2, 2012

You are right,

I´m wrong to try use this event.
To do what I want to do I need two things :

  1. The lenght of youtube video in bytes.
  2. The current downloaded bytes.

It´s possible?

@caprica
Copy link
Owner

caprica commented May 2, 2012

Well, it was still useful to add this event data anyway.

As to your questions:

  1. If mediaPlayer.getLength() doesn't work, then you can't do anything else.
  2. Can't get it.

@dyorgio
Copy link
Author

dyorgio commented May 12, 2012

Hi Mark,

I resolved my problem with this implementation:

  1. Starts two outofProcess players.
  2. First, one with this parameters: ":sout=#standard{mux=ts,access=file,dst=./youtube.tmp}" opening youtube url.
  3. Second, opening youtube.tmp

I made a POC and it worked :), now I'm implementing it inside my player.

@caprica
Copy link
Owner

caprica commented May 12, 2012

To be honest, I don't fully understand the point or use/case that relates to this issue, but if you have something that works for what you need then that's great.

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

No branches or pull requests

2 participants