Page 1 of 1

VLCobject javascript lib

Posted: 25 Jan 2008 12:36
by revolunet
Hi all

i've made a small javascript lib : VLCobject, based on SWFobject (http://blog.deconcept.com/swfobject/)

it just detects and embeds the VLC plugin in pure javascript.

you can find it here : http://code.revolunet.com/VLCobject/EN

i will update my older lib that adds controls to the plugin (VLCjs) to use this detection tool asap

thanx for your comments

Re: VLCobject javascript lib

Posted: 29 Jan 2008 17:55
by revolunet
I added a VLCcontrols library that add commons controls in javascript :

http://code.revolunet.com/VLCcontrols/EN

Re: VLCobject javascript lib

Posted: 22 Apr 2008 21:29
by caio
First of all, thank you very much for the contribution. The library is very nice and easy to use.

Is it possible to launch subtitles from an external srt or ssa file using your library? If possible, could I simply add some command to the html page or it would be necessary to edit the library? I have no idea how to do it.

Re: VLCobject javascript lib

Posted: 23 Apr 2008 11:26
by revolunet
hello dude

yes subtitles can work and even be loaded from local file or URI !!!

im updating the lib today with subtitles handling and others goodies ;)

check it out in a few hours : http://code.revolunet.com/VLCcontrols/EN

Re: VLCobject javascript lib

Posted: 23 Apr 2008 12:32
by revolunet

Re: VLCobject javascript lib

Posted: 24 Apr 2008 00:13
by caio
hello dude

yes subtitles can work and even be loaded from local file or URI !!!

im updating the lib today with subtitles handling and others goodies ;)

check it out in a few hours : http://code.revolunet.com/VLCcontrols/EN
Wow. I'm speechless! I think a lot of people will love the new features, specially the subtitle support. Thank you very much.

Re: VLCobject javascript lib

Posted: 24 Apr 2008 18:01
by caio
I have customized the advanced example to suit my needs. The most important modification is related to filename and subtitle variables.

Code: Select all

// subtitles if (document.getElementById("eng").checked && document.getElementById("filename").value!="") { if (document.getElementById("ssa").checked && document.getElementById("filename").value!="") { vlc_controls.options.set("sub-file", "../videos/" + document.getElementById("filename").value +".Eng.ssa"); } else { vlc_controls.options.set("sub-file", "../videos/" + document.getElementById("filename").value +".Eng.srt"); } } else { if (document.getElementById("ssa").checked && document.getElementById("filename").value!="") { vlc_controls.options.set("sub-file", "../videos/" + document.getElementById("filename").value +".ssa"); } else { vlc_controls.options.set("sub-file", "../videos/" + document.getElementById("filename").value +".srt"); } }
then

Code: Select all

vlc_controls.play("../videos/" + document.getElementById('filename').value +".avi")
and

Code: Select all

<SELECT id="filename"> <OPTION value="videofilenamewithoutextension">videofilenamewithoutextension</OPTION> <SELECT> <input type="checkbox" id="ssa"/> ssa <input type="checkbox" id="eng"/> eng
The code modification above creates a drop-down video list and allow me to choose if I want to load subtitles in English or Portuguese (default language). It also allow to choose between srt and ssa subtitle formats, if available, and automatically load them based on the filename. I know I should use "trim" function instead of adding the avi extension using document.getElementById('filename').value +".avi", but I'm not a programmer and this was the only way I could make it work. I'm only viewing avi and mp4 files anyway, so I replaced my mp4 files extension with avi and this works pretty fine for me.

My problem is that I'm trying to load the page using Mozilla Prism and the subtitles doesn't show up. They work fine in Firefox, but not in Prism. They also fail when embedding the page as a wrapper component in Joomla CMS or as a pop-up window. Any idea why this is happening?

Re: VLCobject javascript lib

Posted: 24 Apr 2008 18:08
by revolunet
Well this i really STRANGE that it works in Firefox and not in Prism as it is firefox based, must be a javascript issue

About joomla, this should be a javascript issue too, check the 'debug' box, when you click the options icon in the VLC widget to see if subtitles options are passed or not...

try to debug and tell us

Re: VLCobject javascript lib

Posted: 24 Apr 2008 20:23
by caio
When using Prism the subtitle path is not found. I tried with an url instead of file path and it works.

Re: VLCobject javascript lib

Posted: 25 Apr 2008 23:05
by caio
When using Prism the subtitle path is not found. I tried with an url instead of file path and it works.
I using file path again because the timer and video seek doesn't work with an url. I'm not sure if this problem is related to buffer or something else, but since the file is on a local server it shouldn't be a problem right?

Another issue I have with the web player is related to the output modules. I prefer DirectX over DirectX3D because the image is more crisp and clear, but when using DirectX with the Firefox plugin and VLCObject the player do not work in full screen. It fills the entire screen, but the video is only displayed in the original size and location. The rest of the screen is rendered black.

Re: VLCobject javascript lib

Posted: 27 Apr 2008 13:43
by revolunet
caio, thank you for detailed information

about the ssek problem : it depends how you host it and which codecs. For example i cannot seek on Apache+Avi files but Apache+mpeg works...

for DirectX, i dont know anything about that, maybe a specific firefox problem

Re: VLCobject javascript lib

Posted: 27 Apr 2008 14:05
by caio
about the ssek problem : it depends how you host it and which codecs. For example i cannot seek on Apache+Avi files but Apache+mpeg works...
Thaks.That explains my problem, because I'm also using Apache+avi.
for DirectX, i dont know anything about that, maybe a specific firefox problem
I don't know why, but it is working now using DirectX 8)

Re: VLCobject javascript lib

Posted: 29 Apr 2009 14:44
by NicoJuicy
With much satisfaction, i'm using your api.

It's great!

However, I'm having a problem sometimes.
Namely, with loading the subtitles and the avi problem of vlc

Is it possible to disable the embedde subtitles? Because I'd like to load external subtitles...

Re: VLCobject javascript lib

Posted: 29 Apr 2009 17:51
by revolunet
embedded subtitles ? you mean in the video itself ?

Re: VLCobject javascript lib

Posted: 29 Apr 2009 21:24
by NicoJuicy
Yes.

When you mux a video with subs (a avi, mkv file can contain subtitles).

Also, i'm still not able to have the subtitles played from a location :(

Re: VLCobject javascript lib

Posted: 30 Apr 2009 10:08
by revolunet
try with the advanced example page :http://www.revolunet.com/static/downloa ... anced.html

Re: VLCobject javascript lib

Posted: 19 Mar 2010 15:31
by marcomoscardini
guys, I have seen mozilla prism being proposed as an option, but same page loaded in firefox, does not work in prism. I have made sure that there is no error in js and the prism console does not show any errors.

[0xa3bbda0] main libvlc debug: VLC media player - version 1.0.5 Goldeneye - (c) 1996-2010 the VideoLAN team
[0xa3bbda0] main libvlc debug: libvlc was configured with ./configure '--build=i686-pc-linux-gnu' '--host=i686-pc-linux-gnu' '--target=i686-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--disable-rpath' '--enable-release' '--with-binary-version=1.0.5-2.fc12' '--with-tuning=no' '--enable-switcher' '--enable-lua' '--enable-live555' '--enable-dv' '--enable-opencv' '--enable-pvr' '--enable-gnomevfs' '--enable-cddax' '--enable-wma-fixed' '--enable-shine' '--enable-faad' '--enable-twolame' '--enable-real' '--enable-realrtsp' '--enable-flac' '--enable-tremor' '--enable-speex' '--enable-tarkin' '--enable-theora' '--enable-dirac' '--enable-libass' '--enable-shout' '--enable-xcb' '--enable-svg' '--enable-snapshot' '--enable-svgalib' '--enable-xvmc' '--enable-directfb' '--enable-aa' '--enable-caca' '--enable-jack' '--enable-portaudio' '--enable-pulse' '--enable-ncurses' '--enable-xosd' '--enable-fbosd' '--enable-galaktos' '--enable-lirc' '--enable-loader' '--enable-mozilla' 'build_alias=i686-pc-linux-gnu' 'host_alias=i686-pc-linux-gnu' 'target_alias=i686-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables' 'PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/share/pkgconfig'
[0xa3bbda0] main libvlc debug: translation test: code is "C"
[0xa3bbda0] main libvlc debug: checking plugin modules
[0xa3bbda0] main libvlc debug: loading plugins cache file /home/user/.cache/vlc/plugins-04041e.dat
[0xa3bbda0] main libvlc debug: recursively browsing `/usr/lib/vlc'
[0xa3bbda0] main libvlc debug: module bank initialized (409 modules)
[0xa3bbda0] main libvlc debug: CPU has capabilities 486 586 MMX MMXEXT SSE SSE2 FPU
[0xa3bbda0] main libvlc debug: looking for memcpy module: 3 candidates
[0xa3bbda0] main libvlc debug: using memcpy module "memcpymmxext"
[0xa471150] main playlist debug: Activated
[0xa473af8] main interface debug: looking for interface module: 1 candidate
[0xa471150] main playlist debug: rebuilding array of current - root Playlist
[0xa471150] main playlist debug: rebuild done - 0 items, index -1
[0xa473af8] main interface debug: using interface module "hotkeys"
[0xa473af8] main interface debug: thread (interface) created at priority 0 (interface/interface.c:151)
[0xa4748e8] main interface debug: looking for interface module: 1 candidate
[0xa4748e8] main interface debug: using interface module "inhibit"
[0xa4748e8] main interface debug: thread (interface) created at priority 0 (interface/interface.c:151)
[0xa476d40] main interface debug: looking for interface module: 1 candidate
[0xa473af8] main interface debug: thread started
[0xa4748e8] main interface debug: thread started
[0xa476d40] main interface debug: using interface module "screensaver"
[0xa476d40] main interface debug: thread (interface) created at priority 0 (interface/interface.c:151)
[0xa476d40] main interface debug: thread started
[0xa483d70] main input debug: Creating an input for 'rtsp://192.168.2.64:554/mpeg4/1/media.amp'
[0xa483d70] main input debug: thread (input) created at priority 10 (input/input.c:230)
[0xa483d70] main input debug: thread started
[0xa483d70] main input debug: using timeshift granularity of 50 MBytes
[0xa483d70] main input debug: using timeshift path '/tmp'
[0xa483d70] main input debug: `rtsp://192.168.2.64:554/mpeg4/1/media.amp' gives access `rtsp' demux `' path `192.168.2.64:554/mpeg4/1/media.amp'
[0xa483d70] main input debug: creating demux: access='rtsp' demux='' path='192.168.2.64:554/mpeg4/1/media.amp'
[0xa2b7128] main demux debug: looking for access_demux module: 1 candidate
Sending request: OPTIONS rtsp://192.168.2.64:554/mpeg4/1/media.amp RTSP/1.0
CSeq: 1
User-Agent: VLC media player (LIVE555 Streaming Media v2009.07.27)


Received OPTIONS response: RTSP/1.0 200 OK
CSeq: 1
Public: DESCRIBE, GET_PARAMETER, PAUSE, PLAY, SETUP, SET_PARAMETER, TEARDOWN

Sending request: DESCRIBE rtsp://192.168.2.64:554/mpeg4/1/media.amp RTSP/1.0
CSeq: 2
Accept: application/sdp
User-Agent: VLC media player (LIVE555 Streaming Media v2009.07.27)

Received DESCRIBE response: RTSP/1.0 200 OK
CSeq: 2
Content-Base: rtsp://192.168.2.64:554/mpeg4/1/media.amp/
Content-Type: application/sdp
Content-Length: 725

Need to read 725 extra bytes
Read 725 extra bytes: v=0
o=- 1269008528650980 1269008528650991 IN IP4 192.168.2.64
s=Media Presentation
e=NONE
c=IN IP4 0.0.0.0
b=AS:3000
t=0 0
a=control:*
a=range:npt=now-
a=mpeg4-iod: "data:application/mpeg4-iod;base64,AoDUAE8BAf/0AQOAbwABQFBkYXRhOmFwcGxpY2F0aW9uL21wZWc0LW9kLWF1O2Jhc2U2NCxBUjBCR3dVZkF4Y0F5U1FBWlFRTklCRUVrK0FBTGNiQUFDM0d3QVlCQkE9PQQNAQUABAAAAAAAAAAAAAYJAQAAAAAAAAAAAzoAAkA2ZGF0YTphcHBsaWNhdGlvbi9tcGVnNC1iaWZzLWF1O2Jhc2U2NCx3QkFTWVFTSVVFVUZQd0E9BBICDQAAAgAAAAAAAAAABQMAAEAGCQEAAAAAAAAAAA=="
a=isma-compliance:1,1.0,1
m=video 0 RTP/AVP 96
b=AS:3000
a=framerate:25.0
a=control:trackID=1
a=rtpmap:96 MP4V-ES/90000
a=fmtp:96 profile-level-id=244; config=000001B0F4000001B5891300000100000001200086C40FA28282078A21
a=mpeg4-esid:201

[0xa2b7128] live555 demux debug: RTP subsession 'video/MP4V-ES'
Sending request: SETUP rtsp://192.168.2.64:554/mpeg4/1/media.amp/trackID=1 RTSP/1.0
CSeq: 3
Transport: RTP/AVP;unicast;client_port=60506-60507
User-Agent: VLC media player (LIVE555 Streaming Media v2009.07.27)

Received SETUP response: RTSP/1.0 200 OK
CSeq: 3
Session: 0793117645;timeout=60
Transport: RTP/AVP;unicast;client_port=60506-60507;server_port=50104-50105;ssrc=431CB0F0;mode="PLAY"

[0xa483d70] main input debug: selecting program id=0
[0xa2b7128] live555 demux debug: setup start: 0.000000 stop:0.000000
Sending request: PLAY rtsp://192.168.2.64:554/mpeg4/1/media.amp/ RTSP/1.0
CSeq: 4
Session: 0793117645
Range: npt=0.000-
User-Agent: VLC media player (LIVE555 Streaming Media v2009.07.27)

Received PLAY response: RTSP/1.0 200 OK
CSeq: 4
Session: 0793117645
Range: npt=now-
RTP-Info: url=trackID=1;seq=63978;rtptime=1848181809

[0xa2b7128] live555 demux debug: We have a timeout of 60 seconds
[0xa2b7128] live555 demux debug: spawned timeout thread
[0xa2b7128] live555 demux debug: play start: 0.000000 stop:0.000000
[0xa2b7128] main demux debug: using access_demux module "live555"
[0xa364838] main decoder debug: looking for decoder module: 38 candidates
[0xa364838] avcodec decoder debug: libavcodec initialized (interface 0x342501)
[0xa364838] avcodec decoder debug: using direct rendering
[0xa364838] avcodec decoder debug: ffmpeg codec (MPEG-4 Video) started
[0xa364838] main decoder debug: using decoder module "avcodec"
[0xa364838] main decoder debug: thread (decoder) created at priority 0 (input/decoder.c:315)
[0xa364838] main decoder debug: thread started
[0xa483d70] main input debug: `rtsp://192.168.2.64:554/mpeg4/1/media.amp' successfully opened
[0xa364838] avcodec decoder debug: ffmpeg codec (MPEG-4 Video) stopped
[0xa364838] main decoder debug: removing module "avcodec"
[0xa364838] main decoder debug: killing decoder fourcc `mp4v', 0 PES in FIFO
Sending request: TEARDOWN rtsp://192.168.2.64:554/mpeg4/1/media.amp/ RTSP/1.0
CSeq: 5
Session: 0793117645
User-Agent: VLC media player (LIVE555 Streaming Media v2009.07.27)

Received TEARDOWN response: RTSP/1.0 200 OK
CSeq: 5
Session: 0793117645

[0xa2b7128] main demux debug: removing module "live555"
[0xa483d70] main input debug: Program doesn't contain anymore ES
[0xa483d70] main input debug: thread ended
[0xa3bbda0] main libvlc debug: deactivating the playlist
[0xa471150] main playlist debug: Deactivate
[0xa471150] main playlist debug: Deactivated
[0xa3bbda0] main libvlc debug: removing all services discovery tasks
[0xa3bbda0] main libvlc debug: removing all interfaces
[0xa476d40] main interface debug: removing module "screensaver"
[0xa4748e8] main interface debug: removing module "inhibit"
[0xa473af8] main interface debug: removing module "hotkeys"
[0xa3bbda0] main libvlc debug: removing playlist
[0xa471150] main playlist debug: Destroyed
[0xa3bbda0] main libvlc debug: removing stats
[0xa3bbda0] main libvlc debug: removing module "memcpymmxext"
[0xa3bbda0] main libvlc debug: writing plugins cache /home/user/.cache/vlc/plugins-04041e.dat
[0xa43bf78] main libvlc debug: VLC media player - version 1.0.5 Goldeneye - (c) 1996-2010 the VideoLAN team
[0xa43bf78] main libvlc debug: libvlc was configured with ./configure '--build=i686-pc-linux-gnu' '--host=i686-pc-linux-gnu' '--target=i686-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--disable-rpath' '--enable-release' '--with-binary-version=1.0.5-2.fc12' '--with-tuning=no' '--enable-switcher' '--enable-lua' '--enable-live555' '--enable-dv' '--enable-opencv' '--enable-pvr' '--enable-gnomevfs' '--enable-cddax' '--enable-wma-fixed' '--enable-shine' '--enable-faad' '--enable-twolame' '--enable-real' '--enable-realrtsp' '--enable-flac' '--enable-tremor' '--enable-speex' '--enable-tarkin' '--enable-theora' '--enable-dirac' '--enable-libass' '--enable-shout' '--enable-xcb' '--enable-svg' '--enable-snapshot' '--enable-svgalib' '--enable-xvmc' '--enable-directfb' '--enable-aa' '--enable-caca' '--enable-jack' '--enable-portaudio' '--enable-pulse' '--enable-ncurses' '--enable-xosd' '--enable-fbosd' '--enable-galaktos' '--enable-lirc' '--enable-loader' '--enable-mozilla' 'build_alias=i686-pc-linux-gnu' 'host_alias=i686-pc-linux-gnu' 'target_alias=i686-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables' 'PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/share/pkgconfig'
[0xa43bf78] main libvlc debug: translation test: code is "C"
[0xa43bf78] main libvlc debug: checking plugin modules
[0xa43bf78] main libvlc debug: loading plugins cache file /home/user/.cache/vlc/plugins-04041e.dat
[0xa43bf78] main libvlc debug: recursively browsing `/usr/lib/vlc'
[0xa43bf78] main libvlc debug: module bank initialized (409 modules)
[0xa43bf78] main libvlc debug: CPU has capabilities 486 586 MMX MMXEXT SSE SSE2 FPU
[0xa43bf78] main libvlc debug: looking for memcpy module: 3 candidates
[0xa43bf78] main libvlc debug: using memcpy module "memcpymmxext"
[0xa428090] main playlist debug: Activated
[0xa437528] main interface debug: looking for interface module: 1 candidate
[0xa437528] main interface debug: using interface module "hotkeys"
[0xa437528] main interface debug: thread (interface) created at priority 0 (interface/interface.c:151)
[0xa438260] main interface debug: looking for interface module: 1 candidate
[0xa428090] main playlist debug: rebuilding array of current - root Playlist
[0xa428090] main playlist debug: rebuild done - 0 items, index -1
[0xa437528] main interface debug: thread started
[0xa438260] main interface debug: using interface module "inhibit"
[0xa438260] main interface debug: thread (interface) created at priority 0 (interface/interface.c:151)
[0xa438bb8] main interface debug: looking for interface module: 1 candidate
[0xa438bb8] main interface debug: using interface module "screensaver"
[0xa438bb8] main interface debug: thread (interface) created at priority 0 (interface/interface.c:151)
[0xa438260] main interface debug: thread started
[0xa438bb8] main interface debug: thread started



well, every thing seams to work correctly, the plugin gets detected, it shows the waiting stream, then after a few seconds it just shows a black screen, any help would be very welcome
same page loaded in firefox, works correctly with no javascript errors
I use the VLCcontrols and firefox on linux fedora 12 (just upgraded)
could it be some problem realted to the output filter? (graphinc acceleration?)

Re: VLCobject javascript lib

Posted: 23 Mar 2010 15:54
by marcomoscardini
ok, I can confirm, it was a problem enabling the plugin in prism