使用硬编码JSON文件中的视频ID在我的android应用中播放youtube视频是否合法。我不想调用YouTube数据API来获取视频。
这是我创建自己的视频JSON。
[
{
"title": "GET FREE INTERNET WITHOUT SIM CARD & WiFI ROUTER FREE INTERNET TECHNOLOGY 2019",
"videoId": "vLRnqUPw16I",
"cat": "tech"
},
{
"title": "Top Upcoming Futuristic Technologies in Smartphones",
"videoId": "A1QrPw2ROks",
"cat": "tech"
},
{
"title": "14 Magic Tricks That You Can Do",
"videoId": "GmONnOGdOk4",
"cat": "magic"
},
{
"title": "15 Magic Tricks That You Can Do",
"videoId": "3_FD_COz61k",
"cat": "magic"
},
{
"title": "NEW TECHNOLOGIES THAT WILL BLOW YOUR MIND",
"videoId": "h924kiLlvA0",
"cat": "tech"
},
{
"title": "10 New Incredible Invention You Need To See",
"videoId": "HrSnBVIjPr4",
"cat": "tech"
},
{
"title": "10 Most Unusual Vehicles",
"videoId": "phFij-01hBk",
"cat": "tech"
},
{
"title": "Top 10 Magic Secrets Of The Year Finally Revealed ",
"videoId": "_OoeRA3F06Y",
"cat": "majic"
}
]
答案 0 :(得分:0)
您可以使用以下线程进行引用:Play Youtube Video inside an Android App without using Android Youtube API
如果您真的想在
iframe
中使用YoutubeWebview
而不是YoutubePlayerFragment
,那么您将需要做一些工作来“重新编码” WebView中用于移动设备的Youtube Player控制层(屏幕尺寸/键码等)。
您还可以检查android-youtube-player
的{{3}},这是官方YouTube API的开源替代品。