Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Have been searching online on how to play youtube video url from a json webservice in my app for example this my json file below.

I know how to parse the rest of the key value pair but having difficulty parsing the key value pair of the youtube url i.e when the user clicks recyclerview item it open youtubeview activity to play each videos

Java
[
    {
        "id": "1",
        "judul": "BANDUNG LEMBANG 3 HARI 2 MALAM",
        "gambar": "https://www.youtube.com/watch?v=y60wDzZt8yg",
        "harga": "Rp. 1.196.000"
    },
    {
        "id": "2",
        "judul": "BANDUNG CIWIDEY 3 HARI 2 MALAM",
        "gambar": "https://www.youtube.com/watch?v=ANM-dq5USTc",
        "harga": "Rp. 1.196.000"
    },
    {
        "id": "3",
        "judul": "BANDUNG COMPLETE 3 HARI 2 MALAM",
        "gambar": "https://www.youtube.com/watch?V=pJC-vohDHl8",
        "harga": "Rp. 1.454.750"
    },
]

Kindly help

What I have tried:

Have searched google for answers
Posted
Updated 2-Apr-18 16:51pm
v2
Comments
David Crow 3-Apr-18 8:10am    
What does your code look like that extracts the gambar value? Are you wanting to play the video from within a browser (i.e., m.youtube.com) or via the YouTube app?
Member 10627743 3-Apr-18 11:50am    
i want to play it in an android app
David Crow 3-Apr-18 11:54am    
So how about trying something like:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + id_of_video));
startActivity(intent);
Member 10627743 3-Apr-18 17:33pm    
Thanks david i will give it a try

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900