Skip to content
This repository has been archived by the owner on Apr 28, 2021. It is now read-only.

little emprovement for init call #13

Open
publicocean0 opened this issue May 31, 2017 · 4 comments
Open

little emprovement for init call #13

publicocean0 opened this issue May 31, 2017 · 4 comments

Comments

@publicocean0
Copy link

publicocean0 commented May 31, 2017

hi ,
your project it is very interesting i m working for integrating it in my player :)

I emproved a bit the init call:

  • style is copied by video el
  • it is possible to create also if video element is not in the dom
  • parent node is more generic
function init(onReady, options) {
	if (!options) options={}
	var polyfillSwfUrl=options.polyfillSwfUrl || 'fMSE.swf';
	var flashByDefault=options.flashByDefault || false;
	var videoElement=options.videoElement||null;
	var parent=options.videoContainer||(videoElement&&videoElement.parentElement)||document.body;
    var isMSESupported = !!window.MediaSource;
    if (isMSESupported && !flashByDefault) {
        return onReady(videoElement);
    }
    window.fMSE.debug=options.debug||false;
    

    window.MediaSource = MediaSourceFlash;

    window.fMSE.callbacks = window.fMSE.callbacks || {};
    window.fMSE.callbacks.onFlashReady = function () {
        onReady(new VideoExtension(swfObj));
    };

    var readyFunctionString = "window.fMSE.callbacks.onFlashReady";

    var height = options.height||(videoElement&&videoElement.height) || 150;
    var width = options.width || (videoElement&&videoElement.width) || 300;
    
    var oldId , oldIdClasses ;
    if (videoElement){
		  oldId = videoElement.id;
         oldIdClasses = videoElement.className;
		
	}
	
	var swfObj = document.createElement("object");
    oldId='e'
    if (oldId) {
		swfObj.setAttribute('id',oldId); 
		swfObj.setAttribute('name',oldId) 
    }
   swfObj.setAttribute('type','application/x-shockwave-flash')
   swfObj.setAttribute('data',polyfillSwfUrl)
   swfObj.setAttribute('width',width)
   swfObj.setAttribute('height',height)
   
    if (oldIdClasses)swfObj.setAttribute('class',oldIdClasses)
   swfObj.setAttribute('style','display:'+(videoElement &&videoElement.style.display?videoElement.style.display:'block'))
    var param = document.createElement("param");  
    param.setAttribute('name','movie')
    param.setAttribute('value',polyfillSwfUrl)
    swfObj.appendChild(param);
     param = document.createElement("param");  
    param.setAttribute('name','flashvars')
    param.setAttribute('value',"readyFunction="+readyFunctionString)
    swfObj.appendChild(param);
     param = document.createElement("param");  
    param.setAttribute('name','allowScriptAccess')
    param.setAttribute('value','always')
    swfObj.appendChild(param);
    
       param = document.createElement("param");  
    param.setAttribute('name','wmode')
    param.setAttribute('value','opaque')
    swfObj.appendChild(param);
    
        param = document.createElement("param");  
    param.setAttribute('name','allowNetworking')
    param.setAttribute('value','all')
    swfObj.appendChild(param);
       param = document.createElement("param");  
    param.setAttribute('name','bgcolor')
    param.setAttribute('value','#000000')
    swfObj.appendChild(param);
    parent.appendChild(swfObj);

    
}
@AxelDelmas
Copy link

Hi @publicocean0
This repository is not maintained and has many critical known issues (for example, seek is not supported).
If you're willing to spend time on the project I can assist you in fixing these issues, but if not I'd advise you to not try to use this in production.

I'm adding a disclaimer on the readme to make this more visible

@publicocean0
Copy link
Author

publicocean0 commented Jun 1, 2017

Hi sincerely i d like to have a mse shim. In the web i cant find a flash fallback.
If you assist me i can try to solve the bugs. Your help would be very usefull surely. I worked just once in flex ... i m not so pratical ... but i had realized a player many years ago ... i have no memories about how ahaha
but i think i can do again. The part not very clear as how to adapt flash stream in mse model

@publicocean0
Copy link
Author

i will work in the free time on the project ... can i send actionscript questions for working on flash player?

@ruslandinov
Copy link
Contributor

Hi @publicocean0 , feel free to send your actionscript questions, I'll try to answer as soon as I have time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants