show global mediaelement to layoutroot? - windows-phone-8

I want to share MediaElement to play video among many pages (only 1 page will show video, others will play sound only).
<MediaElement x:Key="GlobalMedia" Visibility="Collapsed" AutoPlay="True" VerticalAlignment="Center"
Stretch="Uniform" /> // static media element in App.xaml
If I dont show video, everything works so fine. However, when I try to add this MediaElement to LayoutRoot: LayoutRoot.Children.Add(_media), I got InvalideOperationSystem exception (It told me that the mediaElement is already the child of another element). Does anyone has idea to show this global MediaElement to LayoutRoot? Thanks.

Related

Flash object not autoplaying (tumblr)

I have a flash object I need to embed on my tumblr blog (Billy's audio player) and the embed works fine, except that I need to click a white play button before the object works:
(this is in Chrome; there is a similar play button on Edge)
However, other websites don't have this play button over the widget, including the widget's own webpage and the bottom left of this blog.
This is the embed code, taken directly from the Billy's audio player webpage (with added newlines for readability):
<embed src="http://www.sheepproductions.com/billy/billy.swf?autoplay=true&f0=http://www.sheepproductions.com/sammy.mp3&t0=Sammy&total=1"
quality="high" wmode="transparent" width="200" height="10" name="billy"
align="middle" type="application/x-shockwave-flash" title="Adobe Flash Player">
Is there something I can add to make the flash object run automatically? I doubt it's a browser issue, as it works on some other webpages, and other viewers also see the white play button.
However, other websites don't have this play button... including the
widget's own webpage.
SWF and HTML must be in the same exact location (ie: web folder).
If SWF url is : http://www.sheepproductions.com/billy/billy.swf
then HTML must be : http://www.sheepproductions.com/billy/pageWithSWFembeded.html
This issue is caused by the small width/height of your SWF. Browsers assume it is a Flash advert banner and do not auto-load it. It can be fixed by either increasing SWF display size or by putting the small SWF in same location as HTML page that loads the SWF.
Also consider using HTML5 audio tag to guarantee playback of website audio even on mobile devices (they don't run Flash content within default browsers).

Cant get FS button when loading youtube into flash, fs=1 does not work

I am using flash to load a youtube video player with this code:
loader.load(new URLRequest("https://www.youtube.com/v/M7lc1UVf-VE?version=3&autoplay=1&fs=1&modestbranding=1&controls=1"));
The player loads and all intended functionality is there except for the full screen button on the control bar. There is just a settings button where I would expect to be a fs button. I thought the fs=1 param in the url was supposed to make it work however, it is not. Is there another technique or something that I can change to make this work?
-This site seems to have a working example, you need to hover on the small unit for a moment then it will launch the larger unit that has a youtube player with the fs button.
http://www.richmediagallery.com/galleryDetail/?id=36055
Also its interesting to note that if I use the same exact url and load within HTML using Embed/Object, it will work with FS button??!?:(doesnt help me because I need this to work in flash)
<object width="640" height="390">
<param name="movie"
value="https://www.youtube.com/v/M7lc1UVf-VE?version=3&autoplay=1&fs=1&modestbranding=1&controls=1"></param>
<param name="allowScriptAccess" value="always"></param>
<embed src="https://www.youtube.com/v/M7lc1UVf-VE?version=3&autoplay=1&fs=1&modestbranding=1&controls=1"
type="application/x-shockwave-flash"
allowscriptaccess="always"
width="640" height="390"></embed>
</object>
Thanks!
youtube fullscreen button makes swf fullscreen not the player so you need to resize player to fullscreen
first off all add fullscreen eventListener to stage
stage.addEventListener(Event.FULLSCREEN, fullscreen);
then on event change make youtube player fullscreen or normal
private function fullscreen(e:Event):void
{
if (stage.displayState != StageDisplayState.NORMAL)
{
matrix = (player as DisplayObject).transform.matrix;//store matrix
player.setSize(stage.fullScreenWidth, stage.fullScreenHeight);
player.x = player.y = 0;
stage.addChild(player);
}
else
{
player.setSize(normalHeight, normalWidth);
(player as DisplayObject).transform.matrix = matrix;//restore matrix
loader.addChild(player);
}
}
I found a solution however, it was painful to implement.
After alot of guessing/researching the fix was to use DoubleClickStudio lib(google ads) and they have a component lib called YTPlayerProxy.
If you use those together, you can get the FS button to appear.
The biggest challenge was getting this to work within an ide like ftd because those libs were components within Flash Professional. So when coding in an IDE, your ide does not know about that code base and will throw errors everywhere.
To fix that I had to find where the component installed, then grab the swc asset though that was for YTPlayer.
For DoubleClick(I actually had a .fla with double click lib inside that was passed to me. I could not find a place to download from web though I didnt search super hard), I had to convert my .fla to a .zip then find the .swc that was holding double click info.
Once I got both .swc's I loaded them into FDT and everything was good.

WinRT Background Audio

I am going for a most simplistic playback of background audio. I don't even want to capture media controls or anything. I just want to start the app and play audio until I explicitly close it. That is, it should play audio while hidden.
I used this article and this question as reference and I followed their guidance:
<MediaElement Name="someMedia"
AudioCategory="BackgroundCapableMedia"
IsLooping="True"
Source="Assets/some.mp3"
AutoPlay="true"/>
Also, I added Background Tasks to my Package.appxmanifest's Declarations, checked Audio and set the start page. What am I missing?
You should also enable SystemMediaTransportControls and handle two events on it and on your MediaElement to keep them in sync.
Check this article:
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/jj841209.aspx

SoundCloud HTML5 widget: share panel covers waveform when audio finished

When the audio completes in the HTML5 version of the SoundCloud widget, the share panel appears and covers the audio waveform. The user can replay the audio; however, the share panel doesn't disappear, nor does there seem to be any way for the user to hide it. Nor is there any way to prevent the panel from appearing in the first place, which is the ideal option.
The "sharing" parameter is set to false in my embed code.
Here is the embed code I'm using:
<iframe width="100%" height="100%" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F87283114&buying=false&sharing=false&liking=false&show_artwork=false&download=false&show_user=false&show_bpm=false&show_playcount=false&show_comments=false&color=568ED4&theme_color=DDD9C3"></iframe>
Replicated in Firefox and Chrome.
Again, this is an HTML5 issue only. The Flash version works properly.
Note that a similar issue also occurred but was fixed in the Flash version:
New SoundCloud HTML5 widget animation on track finish

HTML over flash without stopping interaction with flash

I have a html div layered on top of an interactive flash movie, but when the mouse moves over the div, it can't interact with the flash (the view changes as the mouse moves or is clicked). Is there a way to have the flash recieve the mouse movements and clicks but leaving the html visible?
I can't modify the flash SWF file.
Edit: To make it clearer, this is an layer of information sitting on top of Google Street View (flash), the trouble is that I can't move the street view around where the layer overlaps.
Try something like this:
<object>
<param name="wmode" value="transparent" />
<embed src="example.swf" wmode="transparent"></embed>
</object>
The main things to note are the <param /> tag with the transparent attribute, and the wmode="transparent" in the embed tag. You'll also need to run the following javascript code to make this work across all browsers:
theObjects = document.getElementsByTagName("object");
for (var i = 0; i < theObjects.length; i++) {
theObjects[i].outerHTML = theObjects[i].outerHTML;
}
This code should be run when the document is loaded. The site I got this code from claims that it must be run from an external file in order to work (although I haven't tested that).
I got this answer from here, where you can get more detail and a working example:
http://www.cssplay.co.uk/menus/flyout_flash.html
I believe the short answer is: No.
Sorry.
However, If you had complete control over how the Flash object is authored - you might be able to expose a public API to the javascript - allowing it to "manually" forward live mouse-coordinate, and mouse-button information into the flash, as you operate the mouse on top of the HTML overlay.
It might be worth checking, if Google's street-view Flash object exposes a public javascript API that might allow you to take some control of the flash - based on mouse-events picked up by your HTML overlay.
Expect the skies to fall, if you try this. :-)
should be aware that wmode=transparent will kill use of scroll wheel in firefox. this is true even in FP10