在Adobe AIR应用程序中播放YouTube视频的选项

时间:2022-09-17 20:27:50

I'm trying to get YouTube content into a Flex 3 AIR application and have tried a number of options using TubeLoc, wrapper as3 classes which all seem to not work.

我正在尝试将YouTube内容添加到Flex 3 AIR应用程序中,并使用TubeLoc尝试了许多选项,包装as3类似乎都无效。

Most recently, I've been trying the method I found at http://www.blackcj.com/blog/tag/youtube/, but still having difficulties with the code not being able to find ytplayer in the test.html. Have been wracking the brains trying to figure out where it should go but no luck.

最近,我一直在尝试在http://www.blackcj.com/blog/tag/youtube/上找到的方法,但仍然遇到代码无法在test.html中找不到ytplayer的问题。一直在绞尽脑力试图弄清楚应该去哪里但没有运气。

Also tried to use an SWFLoader component, but no luck with it either... Basically, I've been trying to use it like this:

还尝试使用SWFLoader组件,但也没有运气...基本上,我一直试图像这样使用它:

<mx:SWFLoader id="player2" source="http://www.youtube.com/swf/l.swf?video_id=xx" autoLoad="true" showBusyCursor="true" width="346" height="194" x="20" y="35"/>

but no luck with that either.

但也没有运气。

Does anyone have any articles or clear steps I can follow to try and get this working?

有没有人有任何文章或明确的步骤我可以遵循尝试让这个工作?

3 个解决方案

#1


I was using tubeloc to play YouTube video inside my Adobe Air application but it has some bugs which made me look for alternatives, which led me to your question and the link you suggested.

我正在使用tubeloc在我的Adobe Air应用程序中播放YouTube视频,但它有一些错误让我寻找替代方案,这导致了我的问题和你建议的链接。

It has served me perfectly well. It's a lot simpler, specially if all you need is to play a video (or some videos).

它非常适合我。它更简单,特别是如果您只需要播放视频(或某些视频)。

About your issue:

关于您的问题:

but still having difficulties with the code not able to find ytplayer in the test.html. Have been wracking the brains trying to figure out where it should go but no luck.

但仍然遇到代码无法在test.html中找到ytplayer的困难。一直在绞尽脑力试图弄清楚应该去哪里但没有运气。

It has happened to me whenever I had something wrong inside the HTML file. Make sure that the JavaScript synthax inside is correct and that the HTML itself is well formed.

每当我在HTML文件中出现错误时,就会发生这种情况。确保里面的JavaScript synthax正确并且HTML本身格式正确。

Also, if you're importing those classes inside your project, don't forget that js folder. I did, and that was a reason for the same error.

此外,如果您要在项目中导入这些类,请不要忘记js文件夹。我做了,这也是同样错误的原因。

If you need more than just play/pause a video, you can extend it's funcionality by taking a look at the YouTube API itself. It's quite simple, actually.

如果您需要的不仅仅是播放/暂停视频,还可以通过查看YouTube API本身来扩展其功能。实际上,这很简单。

Anyways, thanks for providing that link and I hope you get it to work too. :)

无论如何,感谢提供该链接,我希望你也能让它工作。 :)

#2


use the youtube chromless player it was made for embedding youtube videos

使用youtube chromless播放器,它是为嵌入youtube视频而制作的

http://code.google.com/apis/youtube/chromeless_player_reference.html

#3


Well, it seems that loading up the embedded YouTube player via HTML just won't work in my AIR application as the main application configuration has transparency enabled.

好吧,似乎通过HTML加载嵌入式YouTube播放器只能在我的AIR应用程序中工作,因为主应用程序配置已启用透明度。

This is a bug in the AIR framework and it's just not going to work. Apparently an HTMLOverlay can be used to position a window on top of your application, but this smells like a fairly nasty hack to me.

这是AIR框架中的一个错误,它不会起作用。显然,HTMLOverlay可以用来在你的应用程序顶部放置一个窗口,但这对我来说就像是一个相当讨厌的黑客。

#1


I was using tubeloc to play YouTube video inside my Adobe Air application but it has some bugs which made me look for alternatives, which led me to your question and the link you suggested.

我正在使用tubeloc在我的Adobe Air应用程序中播放YouTube视频,但它有一些错误让我寻找替代方案,这导致了我的问题和你建议的链接。

It has served me perfectly well. It's a lot simpler, specially if all you need is to play a video (or some videos).

它非常适合我。它更简单,特别是如果您只需要播放视频(或某些视频)。

About your issue:

关于您的问题:

but still having difficulties with the code not able to find ytplayer in the test.html. Have been wracking the brains trying to figure out where it should go but no luck.

但仍然遇到代码无法在test.html中找到ytplayer的困难。一直在绞尽脑力试图弄清楚应该去哪里但没有运气。

It has happened to me whenever I had something wrong inside the HTML file. Make sure that the JavaScript synthax inside is correct and that the HTML itself is well formed.

每当我在HTML文件中出现错误时,就会发生这种情况。确保里面的JavaScript synthax正确并且HTML本身格式正确。

Also, if you're importing those classes inside your project, don't forget that js folder. I did, and that was a reason for the same error.

此外,如果您要在项目中导入这些类,请不要忘记js文件夹。我做了,这也是同样错误的原因。

If you need more than just play/pause a video, you can extend it's funcionality by taking a look at the YouTube API itself. It's quite simple, actually.

如果您需要的不仅仅是播放/暂停视频,还可以通过查看YouTube API本身来扩展其功能。实际上,这很简单。

Anyways, thanks for providing that link and I hope you get it to work too. :)

无论如何,感谢提供该链接,我希望你也能让它工作。 :)

#2


use the youtube chromless player it was made for embedding youtube videos

使用youtube chromless播放器,它是为嵌入youtube视频而制作的

http://code.google.com/apis/youtube/chromeless_player_reference.html

#3


Well, it seems that loading up the embedded YouTube player via HTML just won't work in my AIR application as the main application configuration has transparency enabled.

好吧,似乎通过HTML加载嵌入式YouTube播放器只能在我的AIR应用程序中工作,因为主应用程序配置已启用透明度。

This is a bug in the AIR framework and it's just not going to work. Apparently an HTMLOverlay can be used to position a window on top of your application, but this smells like a fairly nasty hack to me.

这是AIR框架中的一个错误,它不会起作用。显然,HTMLOverlay可以用来在你的应用程序顶部放置一个窗口,但这对我来说就像是一个相当讨厌的黑客。