Skip to content

How to generate "Golang base64 Session Description" #1019

Closed
@juexun

Description

@juexun

Hi, I'm a newbie to pion.
I run the examples with go run examples.go under webrtc/examples
While I tried the broadcast by accessed the url http://localhost/example/js/broadcast/ on Chrome browser, I got the Browser base64 Session Description.
The question is how to generate the Golang base64 Session Description.
Could anybody help me?
Thanks a lot

Activity

Sean-Der

Sean-Der commented on Feb 11, 2020

@Sean-Der
Member

Hi @juexun

Thanks for checking out Pion! You can generate it by running curl localhost:8080/sdp -d "Browser SDP" then the broadcast binary will print it to stdout.

broadcast has more documentation around it. Please re-open or reach out on Slack if you have more questions.

thanks

RathanakSreang

RathanakSreang commented on Feb 13, 2020

@RathanakSreang

@Sean-Der I also fact this issue.
And I try follow your command above but it still does not work.

Sean-Der

Sean-Der commented on Feb 13, 2020

@Sean-Der
Member

@RathanakSreang are you running the curl command on the same computer you ran broadcast/main.go?

Thanks

RathanakSreang

RathanakSreang commented on Feb 13, 2020

@RathanakSreang

@Sean-Der Yes, I do. But the result i got is just HTML code instead.

Sean-Der

Sean-Der commented on Feb 13, 2020

@Sean-Der
Member

Something else is listening on :8080 then. Probably examples.go ? I would use the JSFiddle link in the broadcast README, and make sure nothing else is running.

robmunro-sg

robmunro-sg commented on Sep 30, 2020

@robmunro-sg

I've just tried this on the lastest trunk branch - I also just get the raw HTML
using: go run examples.go --address localhost:8080
then curl localhost:8080/sdp -d "Browser SDP"

NickThorne123

NickThorne123 commented on Nov 28, 2020

@NickThorne123

OK so I was having a mental block about where $BROWSER_SDP comes from. So will explain here for the benefit of others.

Say you want to run the reflect example, then open the reflect jsfiddle page linked from here. Click on the text [A] from the box called "Browser base64 Session Description". Then go back into the linux bash shell / osx terminal where you have installed the webrtc examples and done a export GO111MODULE=on go get github.com/pion/webrtc/v3/examples/reflect

Now in the examples/reflect directory, enter
echo $BROWSER_SDP | reflect
where $BROWSER_SDP is the text [A] we copied from the jsfiddle "Browser base64 Session Description" box.

The terminal will then print another base64 string which we past into the other box in the jsfiddle page.
Should work now...

elibenjii

elibenjii commented on Jan 12, 2021

@elibenjii

curl localhost:8080/sdp -d "Browser SDP"

Hi, curl localhost:8080/sdp -d "Browser SDP". not working for me, it shows:
curl: (7) Failed to connect to localhost port 8080: Connection refused

Thank you

AlexanderMatveev

AlexanderMatveev commented on Mar 20, 2021

@AlexanderMatveev
curl localhost:8080/sdp -d "Browser SDP"

Gives done in stdout and panic in application:

panic: illegal base64 data at input byte 7

goroutine 1 [running]:
join/signal.Decode(0xc0001b0580, 0xb, 0x1416ac0, 0xc0001c4260)
/Users/alex/GoProjects/join/signal/signal.go:63 +0xd9
main.main()
/Users/alex/GoProjects/join/main.go:22 +0xc5

Because Decode func expects valid base64 string with JSON inside.

Sean-Der

Sean-Der commented on Mar 20, 2021

@Sean-Der
Member

Hey @AlexanderMatveev you don't want to send "Browser SDP" but the base64 value in the textarea

2021-03-20-103304_525x117_scrot

Sean-Der

Sean-Der commented on Mar 20, 2021

@Sean-Der
Member

If you get a chance would you mind updating the docs to be more descriptive? This has confused multiple people, not sure of a better way to work it though.

AlexanderMatveev

AlexanderMatveev commented on Mar 20, 2021

@AlexanderMatveev

@Sean-Der Thanks for response, I got it from code. But I didn't found any information about where must I get this base64-string.

added a commit that references this issue on Mar 20, 2021

3 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @juexun@Sean-Der@AlexanderMatveev@RathanakSreang@NickThorne123

        Issue actions

          How to generate "Golang base64 Session Description" · Issue #1019 · pion/webrtc