Giter Club home page Giter Club logo

swfobject's Introduction

— IMPORTANT UPDATE —

SWFObject is no longer in active development. Flash Player is on the decline, and the authors of SWFObject have moved on to other projects. This project is being left on GitHub for historical purposes.

SWFObject

SWFObject is a free, open-source tool for embedding swf content in websites.

This GitHub edition of SWFObject is our 2.3 beta. The current release – 2.2 – is still available for download at code.google.com/p/swfobject/

CHANGES

SWFObject 2.3 introduces many small changes under the hood (almost exclusively aimed at fixing bugs), but the public API is mostly unchanged and completely backwards compatible with SWFObject 2.2. The only two significant changes to the API:

  1. You may now pass an element as an argument in embedSWF (in place of an ID)

  2. You may now use integers in place of number strings in embedSWF (e.g. 9 instead of “9”).

Example:

OLD:

swfobject.embedSWF("myContent.swf", "my-target-element", "300", "120", "10.0.0");

NEW:

var el = document.getElementById("my-target-element");
swfobject.embedSWF("myContent.swf", el, 300, 120, 10);

Another significant change: SWFObject’s approach to dynamic embedding in Internet Explorer has been updated to use a more W3C-friendly way of creating the <object>. Because this is Internet Explorer, a few hacks were required, but the end result is code generated by W3C techniques (document.createElement). This means, among other things, that nodes generated for XHTML documents should properly self close:

OLD:

<object><param></object>

NEW:

<object><param /></object>

Similarly, since the <param> elements are all generated using the same W3C techniques, encoding flashvars should be less troublesome. Developers will no longer need to create separate flashvars encoding workflows for IE and non-IE browsers.

swfobject's People

Contributors

jhiswin avatar pipwerks avatar t-ashula avatar tensafefrogs avatar tersmitten avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swfobject's Issues

domload event doesnt fire in Firefox

When including swfobject using an AMD module loader the DOMContentLoaded event has already fired, yet the document.readyState is not complete. Instead document.readyStateis interactive.

I've patched this so swfobject works, but for some reason Github won't let me make a pull request right now.
The patch can be seen here:

HenningM@db96a78

When Flash Player version 11 can not get playerVersion in IE11

Case

ShockwaveFlash.version 11.6.602.168
IE11

http://jsfiddle.net/noyobo/hEPb7/11/show/

typeof window.ActiveXObject; //undefined
typeof window.ActiveXObject === "undefined"; //true
!!window.ActiveXObject; //false
window.ActiveXObject === undefined; //false
window.ActiveXObject === void 0; //false
window.ActiveXObject == undefined; //true
window.ActiveXObject == void 0; //true
typeof navigator.plugins; //object
typeof navigator.plugins["Shockwave Flash"]; //undefined
navigator.mimeTypes.length; //0
TypeError: 无法获取未定义或 null 引用的属性“description”
typeof(new window.ActiveXObject("ShockwaveFlash.ShockwaveFlash")); //object
(new window.ActiveXObject("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version"); //WIN 11,6,602,168

u see typeof navigator.plugins["Shockwave Flash"]; //undefined and typeof window.ActiveXObject === "undefined"; //true

source #L51-L63 not work

Images not available in few cases

Static embed method> DomLoad test page
Dynamic embed method> DomLoad test page
Other API methods> swfobject.addLoadEvent(fn)
Other API methods> swfobject.addDomLoadEvent(fn)
Other API methods> swfobject.createCSS(selStr, declStr, mediaStr, newStyleBoolean)
Result:
Image is not available.

SwfObject 2.2 Hang in WebKit

Apologies if this is the wrong place for this post - just looking for some help.

We are building a Spotify Ad in the spotify client (web kit browser within Spotify Desktop Client). When using SwfObject 2.2 and Flash 11+ we see a white box and no flash is loaded.

If we use an earlier version of Flash (eg. 10.2), it runs fine.

Also if we run in a regular browser with the same set up everything works.

Could anybody point me in the right direction for pinpointing the issue - does the white box give us any clues??

Thanks in advance.

expressInstallCallback is never called

When calling swfobject.embedSWF with a flash version number that is higher than what is installed, the client can do an express install and you supply a callback, the callback is never called.

Here you save the callback for later use: https://github.com/swfobject/swfobject/blob/master/swfobject/src/swfobject.js#L348
It is referred to in expressInstallCallback, which is never called: https://github.com/swfobject/swfobject/blob/master/swfobject/src/swfobject.js#L828

This means that a JS application doesn't get a callback with an error telling it that flash needs to be installed.
Your documentation says the callback should be called even on error: http://code.google.com/p/swfobject/wiki/api

removeSWF() takes more than createSWF() created

The constructor and destructor methods are not in sync.

Steps to reproduce:
I give the container element ID to the create function:

swfobject.createSWF(attrObj, parObj,'swf_container');

(swf_container is the ID of an element which is already in the DOM)

Now when I call the destructor function

swfobject.removeSWF('swf_container');

It not only removes the Flash file from the DOM but also the container 'swf_container'.

What's the problem?
This inconsistency is a problem to me, because I am replacing one Flash file with another one at a certain time. As of now I've made a wrapper destructor outside of swfobj that does the same but adds back an element to the DOM.

this.removeSWF = function(elementId){
      var swfParent = document.getElementById(elementId).parentNode;
      swfobject.removeSWF(elementId);
      swfParent.innerHTML = '<div id="'+elementId+'"></div>';
}

I'd love it if swfobj would behave in a more expected manner though.

PercentLoaded Not Working With Large SWFs

Hi, i'm having problem loading large SWF with SwfObject, it works great with small to meduim size SWFs(14 Mega), but once i tried to load a 37 Mega SWF, the percentloaded() stopped working at a certain value, is there a solution for this !

Invalid argument on line 661 in IE

I get "Invalid argument" error, which occurs on line 661, character 5 in IE9. When switching browser mode, the same error occurs, so I believe it's consistent across IE. The problematic block is this one (the logging is mine):

if (ua.ie) {
    if (dynamicStylesheet && typeof dynamicStylesheet.addRule != UNDEF) {
        dynamicStylesheet.addRule(sel, decl);
        console.log(sel); // prints "#[object HTMLDivElement]"
        console.log(decl); // prints "visibility: hidden"
    }
}

Possibly related: the elements I'm targeting have no id, so I'm passing the elements themselves, which I know is possible with SWFObject 2.3 (the reason I went with 2.3).

Please make a Git tag

Hi,

Thanks for creating swfobject, it's a really great project. I use swfobject as a Bower component, but currently I need to reference the version as *. For example:

{
  "name": "my-project",
  "version": "0.0.0",
  "dependencies": {
    "jquery": "~1.9.0",
    "requirejs": "~2.1.8",
    "swfobject": "*"
  }
}

It would significantly improve developer confidence and avoid dependency versioning issues in my project if I could reference a specific version of swfobject. In case you haven't tagged a release with Git before, it's as easy as:

git tag 2.3.0   # Or whatever the version is
git push origin --tags

...And then the tag will show up under Releases. This isn't the type of thing I can make a Pull Request for, unfortunately.

For reference, Bower uses Git tags as the mechanism by which to define versions. Without at least one tag pushed, all users of swfobject via Bower will be running HEAD.

SWFObject and setvariable

I have a function in Javascript that will send a variable to flash and i need to know how that works with swfobject the javascript variable is called "newPage". the flashvariable is "loadvar3".

<script type="text/javascript"> var flashvars = {}; //doesnt work like this flashvars.loadvar3 = newPage; //The below query strings work flashvars.loadvar = swfobject.getQueryParamValue("loadvar"); flashvars.lastname = swfobject.getQueryParamValue("lastname"); flashvars.loadvar5 = swfobject.getQueryParamValue("loadvar5"); ``` var params = { ```

Chrome swfObject create success rate of 65%

Hello I'm develop a video website, for playing rtmp video stream. According my test data.,from my flash (swf file) downloaded success to Flash Dom Object create success, I lost 35% PV. I use SwfObject(https://github.com/swfobject/swfobject) to create Flash Object. Can you give me some suggestions to optimize it, look forward to your reply。

Best Regards.
Flonly

how to allow/play sound in code?

I am trying to embed a live rtmp stream in my website with SWFObject, and the video contains sound. However, when I play it, the video part works good, but without sound (I have tested before with other flash player, the sound worked perfectly). I right click the flash setting, the Sound setting part is unavailable. So I was wondering is there any switch or param to turn the sound on?

XFS warning with Chrome 22.0.1229.94

Issue: when embedding a swf in an iframe on a third party website, two security warnings are thrown in chome's console

Who is affected: Chrome 22.0.1229.94 and most likely other minor releases. Swfobject v2.2 and 2.3

How to reproduce:

Create file iframeContainer.html

<!DOCTYPE html>
<html>
<body>
  <iframe src="iframeContent.html"/>
</body>
</html>

Create file iframeContent.html

<!DOCTYPE html>
<html>
<body>
  <div id="container"></div>
  <!-- Or use http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject_src.js -->
  <script type="text/javascript" src="https://raw.github.com/swfobject/swfobject/master/swfobject/src/swfobject.js"></script>
  <script type="text/javascript">
    swfobject.embedSWF("http://edmullen.net/flash/relog.swf", "container", "150", "150", "9.0.0");
  </script>
</body>
</html>

Open iframeContainer.html in Chome 22.0.1229.94, the following warnings should be in the console

Unsafe JavaScript attempt to access frame with URL iframeContainer.html from frame with URL iframeContent.html. Domains, protocols and ports must match.
  ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject_src.js:201
Unsafe JavaScript attempt to access frame with URL iframeContainer.html from frame with URL iframeContent.html. Domains, protocols and ports must match.
  ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject_src.js:579

Flash embedded with SWFObject can't be run if plugin is not always enabled

If on plugin page in Chromium browser I do not set checkbox "Always Allowed" on Flash plugin I could manually activate flash content on sites which embed swf directly. But if they use SWFObject I always see "Alternative content" as per you test page.

It is because nav.plugins does not have SHOCKWAVE_FLASH item.

There should be possibility to check "possibility to enable" and ask user to do so as it happened in direct method.

Possible this defect in 2.2 is resolved?

I'm having an issue with 2.2 leaking memory in IE8/9 when creating/removing flash player instances, as reported here:

https://code.google.com/p/swfobject/issues/detail?id=619

....repro steps are pretty easy: go to http://www.bobbyvandersluis.com/swfobject/testsuite_2_2/test_api_create_remove.html in IE8, mash createSWF, watch memory balloon in task manager. Even worse is alternating between createSWF/removeSWF doesn't cause memory to go down (it's as though the flash object is being abandoned).

In IE9, the situation is slightly better: mashing create still leaks memory. But if you do create/remove/create/remove... then it'll free up memory like you'd expect.

Any idea if 2.3 fixes this? And is it possible to get two new test pages--one where it calls createSWF continuously, and one where it alternates between createSWF and removeSWF?

Any help greatly appreciated.

flashvars(stream and server) values

If i want to send source authentication mean send a stream to an rtmp server through swfobject with username and password then how to embed that with server URL or any other resource.
I am using wowza server to publishing my webcam stream, it requires source authentication and swfobject didn't carrying username and password with any thing(flashvars etc).
So, anyone know how to send username and password with swfobject (flashvars server:).

swfobject.getObjectById(...).setWindowNum is not a function

//初始化视频插件 function initPlayerExample() { //视频插件初始化参数 var params = { allowFullscreen: "true", allowScriptAccess: "always", bgcolor: "#ffffff", wmode: "transparent" }; var attributes = {}; var flashvars = {}; //初始化flash swfobject.embedSWF("./player.swf", "cmsv6flash", "800", "800", "11.0.0", "expressInstall.swf", flashvars, params, attributes); initFlash(); }

v2.3.20120118 triggers AVG alert

upgraded from 2.2 to v2.3.20120118 and AVG linkscanner reports the code as containing
"mdac activex code execution type 174"

I filed a false positive to AVG, but i figured i'd let you know.

bower error Failed to parse json

Hi, seems like the component.json file is broken:

bower checking out swfobject#73dfbe28226094bfdc4c9e8666ead72e426b93db
bower warn Package swfobject is still using the deprecated "component.json" file
bower error Failed to parse json
Unexpected token }

Add a LICENSE file

To allow the users to correctly include SWFObject according to the MIT license, you should include a LICENSE file containing the license text and especially fill in the <year> and <copyright holders> placeholders! Else it is not possible to fulfill the "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software." part of the license.

I already looked up the <year>, but I can't fill out the <copright holders>:

The MIT License (MIT)

Copyright (c) 2007-2015 <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

ExternalInterface calls fail when using dyanmic embed on IE5.5

Not terribly much to describe here:
In IE5.5, calling a function exposed by ExternalInterface (when using dynamic embedding) throws a JavaScript error (Object Doesn't Support This Property or Method).

This bug is present in v. 2.2, as well as the 2.3 test suite. It only appears to affect IE5.5 -- IE6 and above work fine. The test suite demonstrates this problem nicely:
http://testsuite.learnswfobject.com/2.3/usage-examples/40-swfobject.embedSWF-(External-Interface).php?doctype=html4#

I have no clue if we want to continue supporting this ancient browser, but we should probably document this minor shortcoming somewhere.

v2.2 no work firfox By https

Debuglog:
: Browsing files. Multi Select. Allowed file types: .jpg;.bmp;.png;.gif
SWF DEBUG: Select Handler: Received the files selected from the dialog. Processing the file list...
SWF DEBUG: Event: fileQueued : File ID: SWFUpload_0_0
SWF DEBUG: Event: fileDialogComplete : Finished processing selected files. Files selected: 1. Files Queued: 1
SWF DEBUG: StartUpload: First file in queue
SWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_0
SWF DEBUG: StartUpload(): Upload Type: Normal.
SWF DEBUG: Global Post Item: ASPSESSID=r3bja1hpjeidwfmg5x0nnzxl
SWF DEBUG: Global Post Item: AUTHID=CC1AA1B60391163C5CBA2A544860170E3BE1BB172F92BADFBB58EF583B8F73873A183BDC47F3287B0C71608E25E388926063D5F1054367E087CACB151020C627C2C858E176A676CB55A3AEB7D9EA140320C6F11AD6B474BCD153171C74909A626B49EB78E41A50E95FB016AA9517F18C6960F606BBCCA30CD814059FA08D26BFCDC4A1EB
SWF DEBUG: ReturnUploadStart(): File accepted by startUpload event and readied for standard upload. Starting upload to /api/Upload;jsessionid=r3bja1hpjeidwfmg5x0nnzxl for File ID: SWFUpload_0_0
SWF DEBUG: Event: uploadProgress (OPEN): File ID: SWFUpload_0_0
SWF DEBUG: Event: uploadError : IO Error : File ID: SWFUpload_0_0. IO Error: Error #2038
SWF DEBUG: Event: uploadComplete : Upload cycle complete.
EXCEPTION:

my domain: my.xiaokeduo.com
myCA:*.xiaokeduo.com

can you help me?

Hide control bar permanently

I run my rmtp streaming swf used this,
but i cannot find documentation. how can i hide control bar permanently?

The Future of SWFObjekt?

Hi there,

Is swfobject still being developed or are there any current alternatives to this library?

Thanks!

adding flash video to webpage through SWFobject not playing in browser

Hi community!
I'm new to coding and trying to practice this piece of code but when I launch the code I only get the player and when I press the play button nothing appears.
I've been at this for 3 days now and I am unsure what needs to be corrected. I'm studying html&css design and build websites by Jon Duckett and even he told me what needed to be corrected but the code isn't producing the same results as his code.
If anyone can point out a solution that would be so helpful.
the sample piece can be downloaded here http://www.htmlandcssbook.com/code-samples/
Its chapter 9 adding a flash video. If you need anything from me such as my piece of code I can post that as well.

Proposal for a new API.

The current API for embedding SWF is not easy to use. Some parameters are optional, others are not. Without a good IDE it's difficult to keep track how many null arguments must be passed before one reaches the position in the argument list for parameters.

Thus I'm proposing to implement a new API for SWF embedding by utilizing the builder pattern to describe optional arguments and kicking off the actual embedding.

Old:

embedSWF('myContent', document.getElementById("my-target-element"), 
         '480px', '320px', '9.0.0', null, null, {AllowNetworking: 'none'});

New:

swfobject.embed('myContent.swf', "480px", "320px", '9.0.0')
         .parameters({AllowNetworking: 'none'})
         .into(document.getElementById("my-target-element"));

Maybe the necessary arguments can also passed through the builder pattern but I guess it would be to noisy to specify height and width this way.

What do you think?

No longer checks GetVariable("$version") after embedSWF is called

Working off the original source. Noticed testPlayerVersion() was no longer getting called (it was getting called in an older version I had), meaning GetVariable("$version"); wasn't getting checked/stored either. This was because domLoadFnArr.length was returning 0.

Compared to old version I had, domLoadFnArr variable had function defined in the array when the var was declared at the top. Newest version has the var declaration array empty and sets domLoadFnArr[0] = function later on in the code. Renaming the domLoadFnArr[0] to checkVersion and specifying it within the domLoadFnArr array at the top fixed my issue. Not sure if this change was intended but figured I'd post just in case.

@@ -19,7 +19,7 @@ var swfobject = function () {
         nav = navigator,

         plugin = false,
-           domLoadFnArr = [],
+          domLoadFnArr = [checkVersion],
         regObjArr = [],
         objIdArr = [],
         listenersArr = [],

@@ -286,16 +321,18 @@ var swfobject = function () {
     /* Main function
         - Will preferably execute onDomLoad, otherwise onload (as a fallback)
     */
-        domLoadFnArr[0] = function () {
+       function checkVersion() {

Get error from player

Hello,
I play my streaming use this, but i got some error like "Error Error#2154" etc.
Can i get the error status with my js file which create this swfobject ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.