【问题标题】:how to play you tube embeded code in android application?如何在 android 应用程序中播放 youtube 嵌入代码?
【发布时间】:2011-04-28 05:03:26
【问题描述】:

大家好,这是我的 youtube 嵌入代码。
但我不知道如何在 android 应用程序中播放这个?
我们可以在 webview 或设备播放器中播放吗?

"object width="441" height="353"  
param name="movie" value="http://www.youtube.com/v/u1zgFlCw8Aw?fs=1" param  
param name="allowFullScreen" value="true" param  
param name="allowScriptAccess" value="always" param  
embed src="http://www.youtube.com/v/u1zgFlCw8Aw?fs=1"  
type="application/x-shockwave-flash"  
allowfullscreen="true"  
allowscriptaccess="always"  
width="441" height="353"  
embed>  
object"  

【问题讨论】:

    标签: android video embedded youtube


    【解决方案1】:

    我用它来启动默认设备播放器 -

    Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(url));
    // use this if you want to launch from a non activity class
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
    context.startActivity(intent);
    

    希望这会有所帮助。

    【讨论】:

    • 谢谢。但是如何将这个嵌入代码集成到您的代码中?如果你有任何想法,请帮助我
    • 您可以将您的链接放入一个名为 url 的字符串中,然后使用 Uri.parse(url)
    • 我已经尝试过了,但它不起作用...作为 url 我已将上述嵌入代码作为字符串。
    • embadedurl=" youtube.com/v/u1zgFlCw8Aw?fs=1"</param> youtube.com/v/u1zgFlCw8Aw?fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess=" always" width="441" height="353"> ";Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(embadedurl)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); this.startActivity(intent);
    • 它不起作用是什么意思,你的代码是否抛出任何异常?如果您在从 Activity 扩展的类中编写此代码,则不需要 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    猜你喜欢
    • 2011-08-14
    • 2019-04-21
    • 2013-04-08
    • 1970-01-01
    • 2012-03-09
    • 2012-07-05
    • 1970-01-01
    • 2013-04-08
    相关资源
    最近更新 更多