Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3638

Trying to get response from REST request

$
0
0

I have an Android app where I am trying to get a response a REST call that I have into another class file in my Android app.

Here is the class file that makes the REST call:

public class YouTubeVidIDs extends AsyncTask<String, String, String> {    public String current_YTVidID;    @Override    public String doInBackground(String... params) {        String subYTURL_0 = "https://sunnahboxservice.herokuapp.com/management/youtubeapi/liveStream?channelId=UCos52azQNBgW63_9uDJoPDA";        String subYTURL_1 = "https://sunnahboxservice.herokuapp.com/management/youtubeapi/liveStream?channelId=UUCos52azQNBgW63_9uDJoPDA";        String subYTURL_2 = "https://sunnahboxservice.herokuapp.com/management/youtubeapi/liveStream?channelId=UUCROKYPep-UuODNwyipe6JMw";        String subYTURL_3 = "https://sunnahboxservice.herokuapp.com/management/youtubeapi/liveStream?channelId=UUCN_mfNT4sUszWKfi0Urjv-g";        OkHttpClient client = new OkHttpClient();        Request request = new Request.Builder()                .url(subYTURL_0)                .get()                //.addHeader("accept", "*/*")                .build();        try {            String response = client.newCall(request).execute().toString();            current_YTVidID = response;        } catch (IOException e) {            e.printStackTrace();        }        return current_YTVidID;    }    public void setCurrent_YTVidID(String current_YTVidID) {        this.current_YTVidID = current_YTVidID;    }    public String getCurrent_YTVidID() {        return this.current_YTVidID;    }}

I am trying to pull the result into another class file as follows:

YouTubeVidIDs newID = new YouTubeVidIDs();            String YT_ID = newID.getCurrent_YTVidID();            Movie movie1 = new Movie();            movie1.setId(1);            movie1.getId(1);            movie1.setTitle("Masjid Al-Haram");            movie1.setStudio("Mekkah, KSA");            movie1.setDescription("Live Stream of Masjid Al-Haram");            movie1.setCardImageUrl("http://3.bp.blogspot.com/-ZKjKucsPdzI/TudWC99CE_I/AAAAAAAAAD8/qvWdDtw5IW0/s1600/%2528393%2529.jpg");            movie1.setyTubeID(YT_ID);

I get the following error when it runs:

E/AndroidRuntime: FATAL EXCEPTION: main                  Process: software.blackstone.tvsunnahboxmenu, PID: 3514                  java.lang.IllegalStateException: android.os.DeadObjectException                      at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.K(SourceFile:236)                      at fpm.b(SourceFile:2715)                      at fot.k(SourceFile:15217)                      at vma.run(SourceFile:1051)                      at android.os.Handler.handleCallback(Handler.java:751)                      at android.os.Handler.dispatchMessage(Handler.java:95)                      at android.os.Looper.loop(Looper.java:154)                      at android.app.ActivityThread.main(ActivityThread.java:6077)                      at java.lang.reflect.Method.invoke(Native Method)                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)                   Caused by: android.os.DeadObjectException                      at android.os.BinderProxy.transactNative(Native Method)                      at android.os.BinderProxy.transact(Binder.java:615)                      at com.google.android.apps.youtube.embeddedplayer.service.service.jar.IApiPlayerService$Stub$Proxy.e(SourceFile:473)                      at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.K(SourceFile:233)                      at fpm.b(SourceFile:2715)                       at fot.k(SourceFile:15217)                       at vma.run(SourceFile:1051)                       at android.os.Handler.handleCallback(Handler.java:751)                       at android.os.Handler.dispatchMessage(Handler.java:95)                       at android.os.Looper.loop(Looper.java:154)                       at android.app.ActivityThread.main(ActivityThread.java:6077)                       at java.lang.reflect.Method.invoke(Native Method)                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

When I run it on a physical device - the spinner for the YT video just spins and spins and the video never seems to load and it does not return an error message at all in the app run window of Android Studio.

Where have I made an error, and what is the best way to fix this?


Viewing all articles
Browse latest Browse all 3638

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>