Click here to Skip to main content
15,868,016 members
Articles / Productivity Apps and Services / Sharepoint

Flash Movie Field (SharePoint 2010)

Rate me:
Please Sign up or sign in to vote.
4.50/5 (4 votes)
1 May 2010CPOL3 min read 51.5K   937   7   7
Custom Flash Movie Field to render Flash movies

Figure 1

Figure 1

Figure 2

Figure 2

Introduction

Flash Movie Field is a custom field to render Flash movies and YouTube videos in SharePoint 2010. It uses the excellent swfobject to render the HTML and JavaScript for maximum browser compatibility. In edit mode, authors specify the Url, Width, and Height of the Flash movie. Optional parameters can be added easily by modifying the attached source code.

This is adapted from my WSS 3.0 version for SharePoint 2010.

Description

The Flash Movie Field is based on a new Field Type SPFieldFlashMovie. It has the following properties or column values:

  • Url - URL to Flash (.swf) movie or YouTube video, e.g. /media/map.swf, http://www.youtube.com/v/dMH0bHeiRNg&hl=en&fs=1.
  • Width - Width of Flash movie or YouTube video in pixels. For YouTube video, width includes embedded player.
  • Height - Height of Flash movie or YouTube video in pixels. For YouTube video, height includes embedded player.

Rendering is provided by a custom Field Control FlashMovieField with an associating Rendering Template QuestechFlashMovieFieldTemplate. All UI strings are localized and stored in resource files.

  • \ClientScripts\swfobject.js
    Support JavaScript file for swfobject. Set as Embedded Resource.
  • \ControlTemplates\QuestechFlashMovieFieldTemplate.ascx
    Form edit view of FlashMovieField with RenderingTemplate control.
  • \Fields\SPFieldFlashMovie.cs
    Field Type for custom Flash Movie field. Inherits from SPFieldMultiColumn.
  • \Fields\SPFieldFlashMovieValue.cs
    A class of column values for SPFieldFlashMovie. Inherits from SPFieldMultiColumnValue.
  • \Resources\QuestechCoreFlashMovie.resx
    WSS provisioning resource file and application run-time resource file for localized UI strings. This sets the display name for the custom field and the label strings for properties Url, Width, and Height during authoring. Deploys to ..\14\Resources\.
  • \WebControls\FlashMovieField.cs
    Field Control for SPFieldFlashMovie. Uses swfobject 2.2 to render Flash movies and YouTube videos.
  • \XML\fldtypes_SPFieldFlashMovie.xml
    Field Type Definition for Field Type SPFieldFlashMovie.
  • \Resource.resx
    Project resource file for localized UI strings.
  • \Utility.cs
    Utility file for common methods and properties.

The sample Visual Studio 2010 solution includes all the support files you need to build and deploy the custom field, minus the strong name key file (key.snk). It makes full use of the built-in SharePoint integration. No more third party tools or custom pre and post build scripts are needed to build the SharePoint solution file. 

Installation

To deploy the custom field, follow the procedures below:

  1. Open SharePoint 2010 Management Shell, add solution file QuestechFlashMovie.wsp using Add-SPSolution like:
    Add-SPSolution "C:\QuestechSystems.FlashMovie\bin\Release\QuestechFlashMovie.wsp"

    Or using stsadm, add solution file QuestechFlashMovie.wsp like:

    stsadm -o addsolution 
        -filename "C:\QuestechSystems.FlashMovie\bin\Release\QuestechFlashMovie.wsp"
  2. Open SharePoint 2010 Central Administration, go to System Settings/Manage farm solutions. Deploy QuestechFlashMovie.wsp to select web application(s).
  3. Go to the top site in the selected web application(s). Activate Site Collection feature Questech Systems Flash Movie Columns.

The custom Flash Movie Field should now be ready for use. You can go to the Site Columns gallery to verify. To use the custom field in your SharePoint page, you would first need to add the custom site column to a content type by going to the Site content types gallery. In the gallery listing, select a content type and click Add from existing site columns.

In your page layout file, modify the code as follows:

ASP.NET
...
<%@ Register Tagprefix="QuestechWebControls" 
    Namespace="QuestechSystems.SharePoint.WebControls"
    Assembly="QuestechSystems.SharePoint.FlashMovie, Version=1.0.0.0, 
    Culture=neutral, PublicKeyToken=f268fd4f0f42524c" %>

...
...
<QuestechWebControls:FlashMovieField FieldName="FlashMovieFile" runat="server" />
...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Canada Canada
A Microsoft Certified Professional Developer and Technology Specialist.

Experience and expertise in SharePoint 2016 / 2013 / 2010 / 2007.

Role ranges from a developer in a multi-person team to a solution consultant with expert-level skills, leading a project to completion status.

Proven experience working effectively in a team environment and a self-managed environment.

Comments and Discussions

 
QuestionFLV-Files Pin
labasmuse3-May-12 4:35
labasmuse3-May-12 4:35 
QuestionSomething went Wrong Pin
cyyhqy21-Nov-11 1:24
cyyhqy21-Nov-11 1:24 
GeneralWhere to insert the URL-address of a SWF-file and its sizes? Pin
AndySolo13-Apr-11 1:35
AndySolo13-Apr-11 1:35 
QuestionPage Layout File Pin
ruess26-Aug-10 9:54
ruess26-Aug-10 9:54 
GeneralCopying site columns Pin
Dan Loker18-Jun-10 4:49
Dan Loker18-Jun-10 4:49 
GeneralRe: Copying site columns Pin
Stephen Huen22-Jun-10 19:03
Stephen Huen22-Jun-10 19:03 
QuestionOutputting the field ina Data View? Pin
ucfhocky5517-May-10 8:21
ucfhocky5517-May-10 8:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.