• flash播放实例


    最近做了一个flash播放的实例,东西小,觉得还蛮有用,拿出来给大家伙分享一下,O(∩_∩)O~...

    以下是前台代码:

    View Code 前台代码
     1 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="testFalshPlay.aspx.cs" Inherits="WebApplication1.testFalshPlay" %>
    2
    3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    4
    5 <html xmlns="http://www.w3.org/1999/xhtml" >
    6 <head runat="server">
    7 <title>flash视频播放</title>
    8 </head>
    9 <body>
    10 <form id="form1" runat="server">
    11 <div>
    12 <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" name="flvplayer2011_610_480" width="610" height="488" align="middle" id="flvplayer2011_610_480">
    13 <param name="allowScriptAccess" value="always" />
    14 <param name="allowFullScreen" value="true" />
    15 <param name="movie" value="http://v.soufun.com/sfflvplayer2011_610_480.swf" />
    16 <param name="wmode" value="transparent">
    17 <param name="quality" value="high" />
    18 <param name="bgcolor" value="#ffffff" />
    19 <param name="FlashVars" value='inputstr=<%=playurl %>'>
    20 <embed src="http://v.soufun.com/sfflvplayer2011_610_480.swf" FlashVars='inputstr=<%=playurl %>' quality="high" bgcolor="#ffffff" width="610px" height="488px" name="flvplayer2011_610_480" align="middle" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    21
    22 </object>
    23 </div>
    24 <div>
    25 flash参数说明: <a href="http://www.cnblogs.com/dg5461/articles/1411158.html" target="_blank">http://www.cnblogs.com/dg5461/articles/1411158.html</a>
    26 </div>
    27 </form>
    28 </body>
    29 </html>

    以下是后台代码:

    View Code 后台代码
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Services.Description;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    namespace WebApplication1
    {
    public partial class testFalshPlay : System.Web.UI.Page
    {
    public string playurl = string.Empty;

    protected void Page_Load(object sender, EventArgs e)
    {
    //数据库中filepath字段,视频绝对地址
    string filepath = "http://flvn.soufun.com/2008/08/01/bj/flv/24373d4cd6a94b6fa1e7b5006a27e473.flv";

    城市id, jkn : 北方n/南方s
    string sponsorurl = "http://jkn.v.soufun.com/Interface/GetSponsor.aspx?cityid=1";//将cityid参数去掉后,就没有播放完毕后画面的右侧推荐视频了

    string introURL = "http://v.soufun.com/txt/sfvideo/logodata.xml";//视频片头

    //数据库中attchmentImagesrc或者slpath字段,视频图片绝对地址
    string vimgurl = "";// "http://flvn.soufun.com/2008/08/01/bj/screenshot/24373d4cd6a94b6fa1e7b5006a27e473.jpg";
    playurl = Encode64(filepath).Replace("=", "")
    + "&sponsorURL=" + sponsorurl
    + "&introURL=" + Encode64(introURL).Replace("=", "")
    + "&videoimgurl=" + Encode64(vimgurl).Replace("=", "");

    //string url = "aHR0cDovL2ZsdnMuc291ZnVuLmNvbS8yMDEyLzAxLzE2L2JqL2ltZy8xMzI2Njk5NTQyMTA4LmpwZw";
    //string urlstr = Decode64(url);
    }

    /// <summary>
    /// base64加密
    /// </summary>
    public static string Encode64(string Message)
    {
    char[] Base64Code = new char[]
    {
    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
    'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b',
    'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
    'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
    '4', '5', '6', '7', '8', '9', '+', '/', '='
    };
    byte empty = (byte)0;
    System.Collections.ArrayList byteMessage = new
    System.Collections.ArrayList(System.Text.Encoding.Default.GetBytes
    (Message));
    System.Text.StringBuilder outmessage;
    int messageLen = byteMessage.Count;
    int page = messageLen / 3;
    int use = 0;
    if ((use = messageLen % 3) > 0)
    {
    for (int i = 0; i < 3 - use; i++)
    byteMessage.Add(empty);
    page++;
    }
    outmessage = new System.Text.StringBuilder(page * 4);
    for (int i = 0; i < page; i++)
    {
    byte[] instr = new byte[3];
    instr[0] = (byte)byteMessage[i * 3];
    instr[1] = (byte)byteMessage[i * 3 + 1];
    instr[2] = (byte)byteMessage[i * 3 + 2];
    int[] outstr = new int[4];
    outstr[0] = instr[0] >> 2;
    outstr[1] = ((instr[0] & 0x03) << 4) ^ (instr[1] >> 4);
    if (!instr[1].Equals(empty))
    outstr[2] = ((instr[1] & 0x0f) << 2) ^ (instr[2] >> 6);
    else
    outstr[2] = 64;
    if (!instr[2].Equals(empty))
    outstr[3] = (instr[2] & 0x3f);
    else
    outstr[3] = 64;
    outmessage.Append(Base64Code[outstr[0]]);
    outmessage.Append(Base64Code[outstr[1]]);
    outmessage.Append(Base64Code[outstr[2]]);
    outmessage.Append(Base64Code[outstr[3]]);
    }
    return outmessage.ToString();
    }

    /// <summary>
    /// base64解密
    /// </summary>
    public static string Decode64(string Message)
    {
    string Base64Code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    int page = Message.Length / 4;
    System.Collections.ArrayList outMessage = new System.Collections.ArrayList(page * 3);
    char[] message = Message.ToCharArray();
    for (int i = 0; i < page; i++)
    {
    byte[] instr = new byte[4];
    instr[0] = (byte)Base64Code.IndexOf(message[i * 4]);
    instr[1] = (byte)Base64Code.IndexOf(message[i * 4 + 1]);
    instr[2] = (byte)Base64Code.IndexOf(message[i * 4 + 2]);
    instr[3] = (byte)Base64Code.IndexOf(message[i * 4 + 3]);
    byte[] outstr = new byte[3];
    outstr[0] = (byte)((instr[0] << 2) ^ ((instr[1] & 0x30) >> 4));
    if (instr[2] != 64)
    {
    outstr[1] = (byte)((instr[1] << 4) ^ ((instr[2] & 0x3c) >> 2));
    }
    else
    {
    outstr[2] = 0;
    }
    if (instr[3] != 64)
    {
    outstr[2] = (byte)((instr[2] << 6) ^ instr[3]);
    }
    else
    {
    outstr[2] = 0;
    }
    outMessage.Add(outstr[0]);
    if (outstr[1] != 0)
    outMessage.Add(outstr[1]);
    if (outstr[2] != 0)
    outMessage.Add(outstr[2]);
    }
    byte[] outbyte = (byte[])outMessage.ToArray(Type.GetType("System.Byte"));
    return System.Text.Encoding.Default.GetString(outbyte);
    }

    }
    }

    O(∩_∩)O~  希望木有泄露什么秘密...

  • 相关阅读:
    关于 IIS 上运行 ASP.NET Core 站点的“HTTP 错误 500.19”错误
    下单快发货慢:一个 JOIN SQL 引起 SqlClient 读取数据慢的奇特问题
    ASP.NET Core 2.2 项目升级至 3.0 备忘录
    corefx 源码学习:SqlClient 是如何同步建立 Socket 连接的
    Chimee
    electron-vue:Vue.js 开发 Electron 桌面应用
    H5网页适配 iPhoneX,就是这么简单
    经典文摘:饿了么的 PWA 升级实践(结合Vue.js)
    Table Dragger
    分享8个网站开发中最好用的打印页面插件
  • 原文地址:https://www.cnblogs.com/ry123/p/2334440.html
Copyright © 2020-2023  润新知