在视频播放器组件中灵活加载不同的视频

发布于 2024-11-25 05:14:49 字数 486 浏览 1 评论 0原文

正如一些互联网教程建议的那样,我使用 PHP 和 Flex 为 FLV 视频播放器构建了一个简单的服务器客户端应用程序。我遇到的问题是我无法使用Notepad++更改mxml文件中视频的来源。如果我运行 Flex,则可以更改源,但这不是一个好主意,因为我想通过此播放器运行不同的视频。请建议如何使用此 Flex Video Player 组件运行不同的视频,因为我的应用程序仅适用于 FlexPlayer.mxml 源中给出的此组件 - 也许我不应该将此 mxml 文件用于不同的视频源?

<s:VideoPlayer id="Player" left="0" top="0" width="493" height="382" chromeColor="#2875DE"
    color="#000000" skinClass="MySkin" source="Video Source/Coldplay - Clocks.flv"/>    
</s:Application>

As some Internet tutorial suggested I've built a simple server-client application for FLV Video Player using PHP and Flex. The problem I encountered is that I can't change the source of the video in the mxml file using Notepad++. The source could be changed if I run Flex but It's not a good idea because I want to run different videos through this player. Please suggest how to run different videos with this Flex Video Player component because my application works only for this given in the source of FlexPlayer.mxml-maybe I shouldn't use this mxml file for the different Video Sources?

<s:VideoPlayer id="Player" left="0" top="0" width="493" height="382" chromeColor="#2875DE"
    color="#000000" skinClass="MySkin" source="Video Source/Coldplay - Clocks.flv"/>    
</s:Application>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

微凉 2024-12-02 05:14:49

正确,由于您的 Flex 应用程序已编译,因此您将无法使用它来定义要观看的电影。

但是,您可以使用其他替代方法在运行时将数据提取到应用程序中。

例如,您可以在 html 中的参数中指定视频文件,因为您可以在每次运行之前在记事本或其他文本编辑器中对其进行编辑:

<?xml version="1.0"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
           xmlns:s="library://ns.adobe.com/flex/spark" 
           xmlns:mx="library://ns.adobe.com/flex/mx" >

<s:VideoPlayer id="Player" left="0" top="0" width="493" height="382" chromeColor="#2875DE"
               color="#000000" skinClass="MySkin" source="{this.parameters.videoFile}"/>    

</s:Application>

在这种情况下,您可以在调用 Flex 应用程序的 html 中将其指定为flashvar 参数。在 html 页面中查找以下内容:

    <script type="text/javascript">
        // For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. 
        var swfVersionStr = "10.2.0";
        // To use express install, set to playerProductInstall.swf, otherwise the empty string. 
        var xiSwfUrlStr = "playerProductInstall.swf";
        var flashvars = {};
        flashvars.videoFile = 'Video Source/Coldplay - Clocks.flv';  // specifying video here
        var params = {};
        params.quality = "high";
        params.bgcolor = "#ffffff";
        params.allowscriptaccess = "sameDomain";
        params.allowfullscreen = "true";
        var attributes = {};
        attributes.id = "scratch";
        attributes.name = "scratch";
        attributes.align = "middle";
        swfobject.embedSWF(
            "scratch.swf", "flashContent", 
            "100%", "100%", 
            swfVersionStr, xiSwfUrlStr, 
            flashvars, params, attributes);
        // JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
        swfobject.createCSS("#flashContent", "display:block;text-align:left;");
    </script>

有意义吗?

Correct, since your flex app is compiled, you won't be able to use it to define which movies to watch.

You can however use other alternative methods of fetching data into your app at runtime.

For example, you can specify the video file in a parameter in the html because you CAN edit this in notepad or another text editor before you run it each time :

<?xml version="1.0"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
           xmlns:s="library://ns.adobe.com/flex/spark" 
           xmlns:mx="library://ns.adobe.com/flex/mx" >

<s:VideoPlayer id="Player" left="0" top="0" width="493" height="382" chromeColor="#2875DE"
               color="#000000" skinClass="MySkin" source="{this.parameters.videoFile}"/>    

</s:Application>

In this case, you would specify it in the html that calls your flex app as a flashvar param. Look for this in the html page :

    <script type="text/javascript">
        // For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. 
        var swfVersionStr = "10.2.0";
        // To use express install, set to playerProductInstall.swf, otherwise the empty string. 
        var xiSwfUrlStr = "playerProductInstall.swf";
        var flashvars = {};
        flashvars.videoFile = 'Video Source/Coldplay - Clocks.flv';  // specifying video here
        var params = {};
        params.quality = "high";
        params.bgcolor = "#ffffff";
        params.allowscriptaccess = "sameDomain";
        params.allowfullscreen = "true";
        var attributes = {};
        attributes.id = "scratch";
        attributes.name = "scratch";
        attributes.align = "middle";
        swfobject.embedSWF(
            "scratch.swf", "flashContent", 
            "100%", "100%", 
            swfVersionStr, xiSwfUrlStr, 
            flashvars, params, attributes);
        // JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
        swfobject.createCSS("#flashContent", "display:block;text-align:left;");
    </script>

Make sense?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文