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

LINE app (android) can not retrieve the audio file #30

Closed
cention-sany opened this issue Nov 3, 2016 · 20 comments
Closed

LINE app (android) can not retrieve the audio file #30

cention-sany opened this issue Nov 3, 2016 · 20 comments
Assignees
Labels

Comments

@cention-sany
Copy link

Hi, I not sure if this is the right platform for me to voice this problem. I used Golang line-bot-sdk-go (Messaging API) send audio to my LINE app through a server (Apache server). But my LINE phone app (android) can not play the audio with error message: "Unknown Error. Please wait a moment and try again." From the Apache SSL log, Apache server replied 400 response code which is bad request. It seem like the LINE audio retrieval code can not establish a proper TLS connection with my Apache server. I also tried replace my Apache server with Golang server (HTTP/1.1 and HTTP2) also can not get a proper connection with the audio request where the Golang ServeHTTP(http.ResponseWriter, *http.Request) is never get call though the TCP connection is there. The audio file I sent actually created from my LINE app which received by my Golang application. Note: the path that I sent using the Messaging API is a correct path because simply using Chrome/curl I can get the audio file with 200 response code. And I don't think is the audio file content issue also because the HTTP connection not reach the code opening the audio file.

I mentioned only audio attachment because image and video attachment both successfully sent to my LINE app. If I am in the wrong place to ask question on this problem then you can point me the right place to do so?

@GuitarSucks
Copy link
Contributor

@cention-sany
If it was related to TLS connection you will have error with video or image also.
Older LINE App versions before 6.7.1 had a parameter added to the GET request of audio file. This was not proper way to request a file from client which was changed in 6.7.1 .
Can you check if your are receiving extra parameter in the GET request from client side?

@cention-sany
Copy link
Author

@GuitarSucks, my LINE app version (Android) is 6.8.2. From my Apache log, which has following format:
<IP> - - <Date time timezone> "<GET or POST> <URI> <HTTP version>" <Response code> <total bytes>
The URI string has the correct request URI as expected from my code (the same URI I sent to the LINE Messaging API). This URI string should includes any request parameter if there is any which there isn't any for my case. I not sure if there is any better way to check it. Do let me know how I can do better in checking it. The request do not get pass into my application and was rejected by my Apache server which acted as reverse proxy with Response code 400. As I mentioned, I did try replace the Apache server with a simple debug Golang server as below:

package main

import (
    "crypto/tls"
    "log"
    "net"
    "net/http"
    "net/http/httputil"
)

const (
    certPath   = "cert.pem"
    keyPath    = "key.pem"
    listenAddr = ":443"
)

var (
    useHTTP1 map[string]func(*http.Server, *tls.Conn,
        http.Handler) = map[string]func(*http.Server, *tls.Conn, http.Handler){}
    useHTTP2 map[string]func(*http.Server, *tls.Conn, http.Handler) = nil
)

func handler(w http.ResponseWriter, req *http.Request) {
    hdrs, err := httputil.DumpRequest(req, false)
    if err != nil {
        log.Println("Error in dump request:", err)
        log.Println("req:", req)
    } else {
        log.Print("HTTP Header data:\n", string(hdrs))
    }
    w.Header().Set("Content-Type", "text/plain")
    w.Write([]byte("This is an example server.\n"))
}

func connStateHandler(c net.Conn, cs http.ConnState) {
    log.Println("connect state:", cs.String(), "From:", c.RemoteAddr().String())
}

func main() {
    http.HandleFunc("/", handler)
    s := &http.Server{
        Addr:         listenAddr,
        ConnState:    connStateHandler,
        TLSNextProto: useHTTP1,
    }
    log.Println("About to listen to", listenAddr)
    err := s.ListenAndServeTLS(certPath, keyPath)
    log.Fatal(err)
}

The result of this Golang server log is that there isn't any log from handler func but I can see the connStateHandler of "new", "active" then "close" when I click play the sound in my LINE app. I not sure how I can get the request parameter from this Golang server because the handler func is never get trigger at all. Do let me know if any better way for me to debug this Golang server. NOTE: If I simply run command curl -s -D - <URI> -o /dev/null to this Golang server I can get "new", "active", handler log, "idle" and "close" logging.

@GuitarSucks
Copy link
Contributor

@cention-sany
We are checking this, but our environment is different from yours.
At this point we cant reproduce this.

@cention-sany
Copy link
Author

cention-sany commented Nov 15, 2016

@GuitarSucks I manually contructed the link for this testing as below:
https://43.cust.cention.se/ng/line/attachment/816/307/audio.m4a
Maybe it can help for your side. This link sent into my LINE app which it will give the same error as picture below:
test

@mrmaakun
Copy link

Hello @cention-sany

I was able to reproduce this issue by sending an m4a audio file that is hosted on a golang server via the messaging API and then attempting to play it in the LINE Android App. I was able to play the audio file in the iOS LINE App and access it using Chrome and curl.

Our Android team will look into this issue. We will let you know if they come back with something.

Just for clarification, the file in the link in the above post that you constructed for testing is being served by a golang server, correct?

@cention-sany
Copy link
Author

@mrmaakun to be exact, 43.cust.cention.se has Apache acting as reverse proxy and handle the TLS portion and redirect HTTP request to a golang HTTP server.

@davisray2909
Copy link

Hi @cention-sany , @GuitarSucks , and @mrmaakun
Im also having the same error using Azure server. Do you guys found any solutions yet?
Thanks in advance.

@letrungkien211
Copy link

letrungkien211 commented Mar 31, 2017

I also have the same errors when using Azure Storage. The audio file can be played normally in Iphone, but no luck with Android?
Does Line have plan to fix this?

@davisray2909
Copy link

@letrungkien211 I guess our only option is either using another Storage or wait until Line come up with better solution.

@letrungkien211
Copy link

@davisray2909 That's really sad. I faced similar issue with Video as well. Our team actually contacted Line directly last year but they basically refuse to take action. When I saw this post, I had some hope :(.
Right now we're using Apache in Linux VM as a work around, but Azure storage is just a lot better in term of simplicity and scalibility.

@cention-sany
Copy link
Author

@letrungkien211 I have the almost same issue with Video can not be played but only iOS LINE, Android no issue. Not sure if you facing the same problem or not.

@letrungkien211
Copy link

@davisray2909 Honestly, I don't remember exactly anymore. Maybe it was the same to me.
FYI, I tried multiple solutions:
Create Java Apache server on windows
Use Azure Storage directly
Create Azure C# webapi
Create node-js server in Windows
...
Each of the above solution only make Audio/Video work on either android or iphone. If a solution works on iphone, it doesn't on android and vice versa. I finally gave up months ago.

@davisray2909
Copy link

@letrungkien211 @cention-sany Exactly the same problem.

@fataelislami
Copy link

for the solution , i choose to upload on site google, and copy the direct link into line API
hope it help

@saurabhabh
Copy link

@letrungkien211 @GuitarSucks @mrmaakun Any update on this issue? I am facing the same issue on Azure server. As stated above it works fine if I upload it to the google server or a dropbox.

@tokuhirom
Copy link
Member

@GuitarSucks any updates?

@GuitarSucks
Copy link
Contributor

We will check this issue again. Sorry for the delay

@letrungkien211
Copy link

letrungkien211 commented Nov 30, 2018

@GuitarSucks Any update? We are going to send dynamically created videos to users at Christmas. We'd like to upload them to Azure storage for scalability. This is a blocking issue.

@letrungkien211
Copy link

letrungkien211 commented Dec 1, 2018

Hi, FYI
I've tested and confirmed that when uploading audio (m4a) + video (mp4) to Azure blob storage, the following devices can play them

  1. Iphone 7, 8, 6s
  2. Android: Xperia XZ, Huwei P20 Lite, Xperia Z4, ASUS Zenfone3
    I am asking all our team members to test on more devices and will update this post accordingly.
    I really hope this has been completely resolved. Thanks!

@tkgauri
Copy link
Contributor

tkgauri commented Apr 12, 2019

Hello,

Sorry for taking long to respond to this issue.

We have tested that audio(m4a) can be played successfully on android/iOS devices.
Devices used for testing: iPhone X, Pixel 3

Also, as per letrungkien211's comment dated Dec 1st 2018, audio can be played successfully on other android/iOS devices as well. Refer comment for device details.

For now, we are closing this issue.

If you face similar issue in future please post your question to our community website:
https://www.line-community.me/questions

Thanks!

@tkgauri tkgauri closed this as completed Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants