зеркало из https://github.com/mozilla/shumway.git
Adds real referers to the RTMP connection object.
This commit is contained in:
Родитель
77cc96dac3
Коммит
335fe02175
|
@ -44,7 +44,7 @@ function runSwfPlayer(flashParams) {
|
|||
Shumway.AVM2.Verifier.enabled.value = compilerSettings.verifier;
|
||||
|
||||
Shumway.createAVM2(builtinPath, viewerPlayerglobalInfo, sysMode, appMode, function (avm2) {
|
||||
function runSWF(file) {
|
||||
function runSWF(file, buffer, baseUrl) {
|
||||
var player = new Shumway.Player.Window.WindowPlayer(window, window.parent);
|
||||
player.defaultStageColor = flashParams.bgcolor;
|
||||
player.movieParams = flashParams.movieParams;
|
||||
|
@ -54,17 +54,18 @@ function runSwfPlayer(flashParams) {
|
|||
|
||||
Shumway.ExternalInterfaceService.instance = player.createExternalInterfaceService();
|
||||
|
||||
player.load(file);
|
||||
player.pageUrl = baseUrl;
|
||||
player.load(file, buffer);
|
||||
}
|
||||
Shumway.FileLoadingService.instance.setBaseUrl(baseUrl);
|
||||
if (asyncLoading) {
|
||||
runSWF(movieUrl);
|
||||
runSWF(movieUrl, undefined, baseUrl);
|
||||
} else {
|
||||
new Shumway.BinaryFileReader(movieUrl).readAll(null, function(buffer, error) {
|
||||
if (!buffer) {
|
||||
throw "Unable to open the file " + movieUrl + ": " + error;
|
||||
}
|
||||
runSWF(movieUrl, buffer);
|
||||
runSWF(movieUrl, buffer, baseUrl);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -412,4 +412,9 @@ module Shumway.AVM2.AS.flash.display {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface IRootElementService {
|
||||
pageUrl: string;
|
||||
swfUrl: string;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,16 +102,19 @@ module Shumway.AVM2.AS.flash.net {
|
|||
return;
|
||||
}
|
||||
|
||||
var service: display.IRootElementService =
|
||||
Shumway.AVM2.Runtime.AVM2.instance.globals['Shumway.Player.Utils'];
|
||||
|
||||
var rtmpProps = wrapJSObject({
|
||||
app: parsedURL.app,
|
||||
flashver: 'MAC 11,6,602,180', // ? flash.system.Capabilities.version,
|
||||
swfUrl: 'http://localhost:5080/demos/Something.swf',
|
||||
flashver: flash.system.Capabilities.version,
|
||||
swfUrl: service.swfUrl,
|
||||
tcUrl: command,
|
||||
fpad: false,
|
||||
audioCodecs: 0x0FFF,
|
||||
videoCodecs: 0x00FF,
|
||||
videoFunction: 1,
|
||||
pageUrl: 'http://localhost:5080/demos/Something.html',
|
||||
pageUrl: service.pageUrl || service.swfUrl,
|
||||
objectEncoding: 0
|
||||
});
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ module Shumway.Player {
|
|||
import IAssetResolver = Timeline.IAssetResolver;
|
||||
import IFSCommandListener = flash.system.IFSCommandListener;
|
||||
import IVideoElementService = flash.net.IVideoElementService;
|
||||
import IRootElementService = flash.display.IRootElementService;
|
||||
import MessageTag = Shumway.Remoting.MessageTag;
|
||||
import VideoControlEvent = Shumway.Remoting.VideoControlEvent;
|
||||
import VideoPlaybackEvent = Shumway.Remoting.VideoPlaybackEvent;
|
||||
|
@ -55,7 +56,7 @@ module Shumway.Player {
|
|||
* synchronizes the frame tree with the display list.
|
||||
*/
|
||||
export class Player implements IBitmapDataSerializer, IFSCommandListener, IVideoElementService,
|
||||
IAssetResolver {
|
||||
IAssetResolver, IRootElementService {
|
||||
private _stage: flash.display.Stage;
|
||||
private _loader: flash.display.Loader;
|
||||
private _loaderInfo: flash.display.LoaderInfo;
|
||||
|
@ -130,6 +131,16 @@ module Shumway.Player {
|
|||
*/
|
||||
private _hasFocus = true;
|
||||
|
||||
/**
|
||||
* Page URL that hosts SWF.
|
||||
*/
|
||||
private _pageUrl: string = null;
|
||||
|
||||
/**
|
||||
* SWF URL.
|
||||
*/
|
||||
private _swfUrl: string = null;
|
||||
|
||||
constructor() {
|
||||
this._keyboardEventDispatcher = new KeyboardEventDispatcher();
|
||||
this._mouseEventDispatcher = new MouseEventDispatcher();
|
||||
|
@ -168,8 +179,21 @@ module Shumway.Player {
|
|||
return !this._isPageVisible;
|
||||
}
|
||||
|
||||
public get pageUrl(): string {
|
||||
return this._pageUrl;
|
||||
}
|
||||
|
||||
public set pageUrl(value: string) {
|
||||
this._pageUrl = value;
|
||||
}
|
||||
|
||||
public get swfUrl(): string {
|
||||
return this._swfUrl;
|
||||
}
|
||||
|
||||
public load(url: string, buffer?: ArrayBuffer) {
|
||||
release || assert (!this._loader, "Can't load twice.");
|
||||
this._swfUrl = url;
|
||||
this._stage = new flash.display.Stage();
|
||||
var loader = this._loader = flash.display.Loader.getRootLoader();
|
||||
var loaderInfo = this._loaderInfo = loader.contentLoaderInfo;
|
||||
|
|
|
@ -98,7 +98,7 @@ function runSwfPlayer(flashParams) {
|
|||
var baseUrl = flashParams.baseUrl;
|
||||
var movieUrl = flashParams.url;
|
||||
Shumway.createAVM2(builtinPath, viewerPlayerglobalInfo, sysMode, appMode, function (avm2) {
|
||||
function runSWF(file) {
|
||||
function runSWF(file, buffer, baseUrl) {
|
||||
var movieParams = flashParams.movieParams;
|
||||
var objectParams = flashParams.objectParams;
|
||||
|
||||
|
@ -109,7 +109,8 @@ function runSwfPlayer(flashParams) {
|
|||
player.stageScale = (objectParams && objectParams.scale) || 'showall';
|
||||
player.displayParameters = flashParams.displayParameters;
|
||||
|
||||
player.load(file);
|
||||
player.pageUrl = baseUrl;
|
||||
player.load(file, buffer);
|
||||
|
||||
Shumway.ExternalInterfaceService.instance = player.createExternalInterfaceService();
|
||||
|
||||
|
@ -120,13 +121,13 @@ function runSwfPlayer(flashParams) {
|
|||
}
|
||||
file = Shumway.FileLoadingService.instance.setBaseUrl(baseUrl);
|
||||
if (asyncLoading) {
|
||||
runSWF(movieUrl);
|
||||
runSWF(movieUrl, undefined, baseUrl);
|
||||
} else {
|
||||
new Shumway.BinaryFileReader(movieUrl).readAll(null, function(buffer, error) {
|
||||
if (!buffer) {
|
||||
throw "Unable to open the file " + file + ": " + error;
|
||||
}
|
||||
runSWF(movieUrl, buffer);
|
||||
runSWF(movieUrl, buffer, baseUrl);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче