duongtung4691 / android-youtube-player

Automatically exported from code.google.com/p/android-youtube-player
0 stars 0 forks source link

Youtube API changed #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. make sure internet connected
2. try to open youtube video
3. it show message: Cannot play video 

What is the expected output? What do you see instead?
expect to play youtube video but it is show eeror message that video cannot be 
played. 

What version of the product are you using? On what operating system?
2.3 and above

Please provide any additional information below.
it is new case happend before 2 days almost

Original issue reported on code.google.com by a.barq...@iaraby.com on 29 Sep 2012 at 8:56

GoogleCodeExporter commented 9 years ago
Same here!

I've been using the same code for 3-4 months now without any problems and 
didn't change anything to the code. Since a few days i'm getting the "Error 
(1,-1004)" error.

Original comment by raymondc...@gmail.com on 30 Sep 2012 at 1:03

GoogleCodeExporter commented 9 years ago
I've been having trouble for a few days now. I get the error message "this 
video can't be played".

Original comment by astro.su...@gmail.com on 30 Sep 2012 at 6:11

GoogleCodeExporter commented 9 years ago
fix:

VideoStream.java (Line: 30)
change: mUrl = lArgMap.get("url");
to:  mUrl = lArgMap.get("url") + "&signature=" + lArgMap.get("sig");

Original comment by raymondc...@gmail.com on 30 Sep 2012 at 6:37

GoogleCodeExporter commented 9 years ago
Adding the signature parameter to mUrl worked a few days ago (I used it in my 
own app) but it does not work anymore, so we will all have to keep digging.

Original comment by kiana.te...@gmail.com on 3 Oct 2012 at 12:44

GoogleCodeExporter commented 9 years ago
Hi, the above fix did not work for me. (mUrl = lArgMap.get("url") + 
"&signature=" + lArgMap.get("sig");)

Original comment by tglservi...@gmail.com on 3 Oct 2012 at 12:46

GoogleCodeExporter commented 9 years ago
guys i think the fix is woking, just re-test it again to make sure:

mUrl = lArgMap.get("url")+ "&signature=" + lArgMap.get("sig");

Original comment by a.barq...@iaraby.com on 3 Oct 2012 at 7:48

GoogleCodeExporter commented 9 years ago
Retested. Definitely not working for me. Did it work for you?

Original comment by tglservi...@gmail.com on 3 Oct 2012 at 3:34

GoogleCodeExporter commented 9 years ago
Not working for me too.

Original comment by victor...@gmail.com on 4 Oct 2012 at 6:05

GoogleCodeExporter commented 9 years ago
I've tested above solution, its working for me!!
Thanks!

Original comment by s20021...@gmail.com on 5 Oct 2012 at 7:35

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
s20021, are you sure? What did you do exactly? A reply would be most helpful to 
a lot of people. Thanks

Original comment by yasin.ac...@gmail.com on 5 Oct 2012 at 11:48

GoogleCodeExporter commented 9 years ago
Can anyone upload the fix?
Thanks.

Original comment by victor...@gmail.com on 5 Oct 2012 at 3:20

GoogleCodeExporter commented 9 years ago
Hi, the solution above, sometimes work, but sometimes try 2 or 3 times it work.

Original comment by huot.pen...@gmail.com on 6 Oct 2012 at 5:16

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Same issue with youtube player api use

I've been using the same code and didn't change anything to the code. Since a 
few days i'm getting the "Error (1,-1004)" error.

please help me.

Original comment by naveen.k...@halosys.com on 8 Oct 2012 at 6:32

GoogleCodeExporter commented 9 years ago
This fix seems to be working for me.

How the heck did you figure this out? Props.

Original comment by Heathe...@gmail.com on 8 Oct 2012 at 6:09

GoogleCodeExporter commented 9 years ago
hai all,
Again video is not playing please help me...

Original comment by SRIKIRAN...@gmail.com on 11 Oct 2012 at 1:11

GoogleCodeExporter commented 9 years ago
Youtube has been banned in my country.. can't even check... please post a 100% 
working solution...

Original comment by mhameed1...@gmail.com on 12 Oct 2012 at 9:55

GoogleCodeExporter commented 9 years ago
It does not seem to be fixed through signature..
Is there any other solution?

Original comment by malik.t...@gmail.com on 13 Oct 2012 at 7:50

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
i think it is under youtubeutility.java
Do we have to install the latest version of youtube activity ?

Original comment by malik.t...@gmail.com on 15 Oct 2012 at 12:23

GoogleCodeExporter commented 9 years ago
sorry its VideoStream.java

Original comment by malik.t...@gmail.com on 15 Oct 2012 at 12:59

GoogleCodeExporter commented 9 years ago
i'm getting a 1,403 error, and i can't play the video.

Original comment by PieterTi...@gmail.com on 19 Oct 2012 at 8:05

GoogleCodeExporter commented 9 years ago
for people saying that it does not work, did you tried below fix:

go to class: VideoStream.java
change:       mUrl = lArgMap.get("url");
to:               mUrl = lArgMap.get("url")+ "&signature=" + lArgMap.get("sig");

If yes what is your device and what is your country ... because it is work with 
me.  

Original comment by a.barq...@iaraby.com on 19 Oct 2012 at 8:48

GoogleCodeExporter commented 9 years ago
my country is the netherlands, and i'm using a samsung galaxy S2, and i've 
tried chaning the code but it didn't help

Original comment by PieterTi...@gmail.com on 19 Oct 2012 at 11:54

GoogleCodeExporter commented 9 years ago
UK, Galaxy S2 same problem. Updated code as it says. Same issue. For those whom 
it worked for, can you not upload your version for us to try?

Original comment by tglservi...@gmail.com on 19 Oct 2012 at 5:19

GoogleCodeExporter commented 9 years ago
I had to make a few additional fixes to correct the URL. I changed 
VideoStream:26:

From:
    lArgMap.put(lArgValStrArr[0], lArgValStrArr[1]);

To:
    String value = lArgValStrArr[1];
    if (value.startsWith("http")) {
        value = value.replace("---", ".");
        value = URLDecoder.decode(value);
    }
    lArgMap.put(lArgValStrArr[0], value);

As mentioned above, the signature is also required on line 30:

From:
    mUrl = lArgMap.get("url");

To:
    mUrl = lArgMap.get("url") + "&signature=" + lArgMap.get("sig");

This appeared to work on all devices; I tested from 2.3 up.

Original comment by pflammer...@gmail.com on 24 Oct 2012 at 10:07

GoogleCodeExporter commented 9 years ago
still not working

this is my videostream:

/**
     * Construct a video stream from one of the strings obtained 
     *  from the "url_encoded_fmt_stream_map" parameter if the video_info 
     * @param pStreamStr - one of the strings from "url_encoded_fmt_stream_map"
     */
    public VideoStream(String pStreamStr){
        String[] lArgs=pStreamStr.split("&");
        Map<String,String> lArgMap = new HashMap<String, String>();
        for(int i=0; i<lArgs.length; i++){
            String[] lArgValStrArr = lArgs[i].split("=");
            if(lArgValStrArr != null){
                if(lArgValStrArr.length >= 2){
                    String value = lArgValStrArr[1];
                    if (value.startsWith("http")) {
                        value = value.replace("---", ".");
                        value = URLDecoder.decode(value);
                    }
                    lArgMap.put(lArgValStrArr[0], value);
                }
            }
        }
        mUrl = lArgMap.get("url") + "&signature=" + lArgMap.get("sig");
    }
    public String getUrl(){
        return mUrl;
    }
}
my string:

 Uri uri = Uri.parse(URL);
          String videoId = uri.getQueryParameter("v");
          Intent lVideoIntentd = new Intent(null, Uri.parse("ytv://"+videoId), this, OpenYouTubePlayerActivity.class);
          startActivity(lVideoIntentd);
         }

my URL String: public static final String url = 
"http://www.youtube.com/watch?v=MkT2wW3-1jQ";

can anyone help?

Original comment by PieterTi...@gmail.com on 14 Nov 2012 at 1:47

GoogleCodeExporter commented 9 years ago
I have an HTC EVO and have no problem playing the videos.
I recently got a Samsung Galaxy S iii and videos can't be played when WiFi is 
off and using 3G. However, when WiFi is connected, then it works!! Anyone with 
same issue and suggestion on how to fix??

Original comment by kkash...@gmail.com on 28 Nov 2012 at 2:50

GoogleCodeExporter commented 9 years ago
OpenYotubeActivity.java  needs to be corresponded to LTE.

I used a customized Activity class  in order to correspond LTE network type as 
follows.

-------  OpenYotubeActivity.QueryYouTubeTask#doInBackground(YouTubeId... 
pParams)   ---------

        WifiManager lWifiManager = (WifiManager) cxt.getSystemService(Context.WIFI_SERVICE);
        TelephonyManager lTelephonyManager = (TelephonyManager) cxt.getSystemService(Context.TELEPHONY_SERVICE);

        ////////////////////////////
        // if we have a fast connection (wifi or 3g), then we'll get a high quality YouTube video
        if( (lWifiManager.isWifiEnabled() && lWifiManager.getConnectionInfo() != null && lWifiManager.getConnectionInfo().getIpAddress() != 0) ||
                ( (lTelephonyManager.getNetworkType() == TelephonyManager.NETWORK_TYPE_UMTS ||

                /* icky... using literals to make backwards compatible with 1.5 and 1.6 */      
                lTelephonyManager.getNetworkType() == 9 /*HSUPA*/  ||
                lTelephonyManager.getNetworkType() == 10 /*HSPA*/  ||
                lTelephonyManager.getNetworkType() == 8 /*HSDPA*/  ||
                lTelephonyManager.getNetworkType() == 5 /*EVDO_0*/  ||
                lTelephonyManager.getNetworkType() == 6 /*EVDO A*/  ||
                lTelephonyManager.getNetworkType() == 13 /*LTE*/)           // <--- Add!!

                && lTelephonyManager.getDataState() == TelephonyManager.DATA_CONNECTED) 
                ){
            lYouTubeFmtQuality = "18";

-------------------

Original comment by yasikob...@gmail.com on 29 Nov 2012 at 10:20