Closed fherking closed 7 months ago
Hello, CORS is missing.
It is not part of the codebae but could be added easily. Using this code.
Or you could just make sure that the oriign where you play the video is the same as the go-transcode. By using reverse proxy.
E.g:
/vod/*
on your reverse proxy to 192.168.10.3:44444/vod/
That means when you play your video on example.com/player.html
it needs to request videos from /vod/*
and it matches origin policy.
Hello, thanks, for your answer and time, i'm gonna compile now the server with the new code you sent me and see if it works, because i don't have a reverse proxy setup at the moment... (Yes I know its a couple of lines in apache but , I configured one once upon a time and alzhéimer is kicking in... if It doesn't work I tell you something about my setup ... )
Thanks and
Ok, its working now (at least it seems) had to :
go import "github.com/go-chi/cors"
modify :
./go-transcode/internal/http/http.go
add imports to that file
"github.com/go-chi/cors"
and the code i used is where the router is created :
router.Use(cors.Handler(cors.Options{
AllowOriginFunc: conf.AllowOrigin, <-deleted this line, giving me errors about conf/config object not having the function.... it seems to be working anyway.
AllowedMethods: []string{"GET", "POST", "DELETE", "OPTIONS"},
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"},
ExposedHeaders: []string{"Link"},
AllowCredentials: true,
MaxAge: 300, // Maximum value not ignored by any of major browsers
}))
I still am not able to play anything in chrome , edge , firefox and firedragon, BUT at least its not complaining about security concerns (all dev tools give ok 200 to all files) and in media player classic and vlc plays ok.
I suppose that it fails for the codec.
For the moment Im trying different js players to see if someone works with this hls file format / codec , if you know anyone that works, that would be a plus.
THANKS for your time and patience
For me this problem is closed as valid.
As always, thanks for your time and help.
I use video.js with http-streaming plugin, works most of the time for me: https://github.com/m1k1o/go-transcode/blob/f7cf54dbf7cde826d8a8be58f18a6375ddbf6f4c/internal/api/play.html
thanks ill try tomorrow happy new year and thanks for everything [image: image.png]
Added cors: [bool]
to config.
Hello: I configured the server (i think that ok), when I watch movies from mpc-hc or vlc I can access the file, transcode is good and I can view the file from any machine
when I try to access the file from an html through a web broser I get the following error:
xxxxx.html:1 Access to XMLHttpRequest at 'http://192.168.10.3:44444/vod/xxxx/yyy/360p.m3u8' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Is there any way to set cross origin policy on the server ( even if i need to change the source code and recompile) or I'm doing something wrong?
thanks in advance