Copy link to clipboard
Copied
Hi Everyone,
I am at the final stages of releasing a product to my client and if I dont get this problem fixed it may be detrimental to me getting paid, so much hair has been pulled out so far!!!
I have a created a bbc iplayer type application that downloads videos, stores them for viewing offline and plays the selected one. Before the selected video is played, a 10 second flv containing the clients logo plays.
This works fine on a windows system but a Mac doenst like it. The intro animation plays, but when it is finished it does not play the second video loaded into the videodisplay component.
If this works on a windows system it means there is nothing wrong with my code - right? The both videos exist and the player plays both so therefore the code is ok. Is there a known problem about how the videodisplay component renders video on the Mac?
I thought one of the benefits of using something like Air was that you didnt have to worry about the operating system it resides on.
Here is a simplified version of my code below if anyone can spot why this would be.
----------------------------------------------------------------
//Called on creationComplete
protected function onComplete(evt:FlexEvent):void { launchSplash() }
protected function launchSplash():void
{
//trace(">>VideoPlayerPanel:launchSplash--")
_videoDisplay.source = "assets/Ident.flv";
_videoDisplay.addEventListener(VideoEvent.COMPLETE,onSplashComplete)
disablePlayercontrols()
}
protected function onSplashComplete(evt:VideoEvent):void
{
trace(">>VideoPlayerPanel:onSplashComplete--")
_videoDisplay.removeEventListener(VideoEvent.COMPLETE, onSplashComplete)
_videoDisplay.stop();
_videoDisplay.source = null;
_videoDisplay.close()
Alert.show("Starting 1.5 Second Timer","onSplashComplete")
var _pauseTimer:Timer = new Timer(1500,1)
_pauseTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete)
_pauseTimer.start()
function onTimerComplete(event:TimerEvent):void
{
trace(">>VideoPlayerPanel:onSplashComplete:onTimerComplete--")
Alert.show("Timer Completed - Setting Video to play","onTimerComplete")
_pauseTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete)
_pauseTimer.reset()
playSelectedVideo()
}
}
protected function playSelectedVideo():void
{
trace(">>VideoPlayerPanel:playSelectedVideo--")
Alert.show("Video Should be playing","playSelectedVideo")
_videoDisplay.source = _vidSource;
_videoDisplay.play()
enablePlayercontrols()
if(_videoData.type.toString() == "audio"){showAudioImage()}
}
----------------------------------------------------------------
If anyone can help me on this one I greatly appreciate it as I work on my own so have no one to look over my code...
THANKS!
Copy link to clipboard
Copied
Hi,
Is it possible to get a copy of your application for testing? It sounds very suspicious if you're able to run this fine on Windows, but it fails on Mac. Please feel free to contact me at ccampbel@adobe.com.
Moved discussion to the Problems & Bugs forum.
Thanks,
Chris
Copy link to clipboard
Copied
Hi Chris,
Any update on this? I have emailed you the source files but havnt heard anything back. I am just wondering if I should continue waiting for your opinion or not?
Thanks.
Copy link to clipboard
Copied
Hi,
Unfortunately I haven't received anything but it's very possible our email filter blocked it based on our attachment rules. What day did you send it? I can go search blocked email for that day or if you could send it again and strip out the attachment's extension it should get through.
Thanks,
Chris
Copy link to clipboard
Copied
Hi Chris,
Thanks for getting back to me. I sent you an email (ccampbel@adobe.com)
with my application source code attached in zip form on 19/08/2010 at 08:53.
I am still testing at the moment as my client needs to see some progress, so
I would be very appreciative of your comments.
Thanks Chris,
Robert Eastham
Copy link to clipboard
Copied
Hi Robert,
I've found your email and just sent you a reply.
Chris
Copy link to clipboard
Copied
Hi Chris,
I am about to send you a very basic test - much easier to see the problem
on this one.
It works on the pc but not the mac.
I will send it straight after this one so you know to check your mail
filter.
best wishes,
Robert Eastham
Copy link to clipboard
Copied
Hi Chris,
I have got hold of a Mac for testing with and have recreated the problem in
this application attached. It is simply a video display that loads in an
flv that selected by the user using the File class for reference.
Please let me know what you find so I can update my client.
Once again many thanks for taking time to look at this.
best wishes,
Robert Eastham
Copy link to clipboard
Copied
can u send me basic source code of it so that i can tell u what problem is?
Copy link to clipboard
Copied
Hi, OK here is the basic code in two forms - one attached and the other one
pasted below:
The Ident video plays fine, but the video loaded in by the user does not
play on the Mac (fine on windows)
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" initialize="init()">
<mx:Panel width="100%" height="100%" title="Video Window">
<mx:VideoDisplay id="_vidDisplay" width="100%" height="100%" source="ident.flv" autoPlay="false" />
<mx:ApplicationControlBar width="100%">
<mx:TextArea height="20" width="100%" text=""/>
<mx:Button label="Browse" click="{browseForFile(event)}" />
<mx:Button label="Play" click="{_vidDisplay.play()}" />
</mx:ApplicationControlBar>
</mx:Panel>
<mx:Script>
<![CDATA[
import flash.events.Event;
import flash.events.MouseEvent;
import flash.filesystem.File
import mx.events.VideoEvent;
protected var _appDir:File;
[Bindable]
protected var _vidSource:String;
protected function init():void
{
_vidDisplay.addEventListener(VideoEvent.COMPLETE,onSplashComplete)
}
protected function browseForFile (evt:MouseEvent):void
{
trace(">>Main:browseForFile--")
_appDir = File.userDirectory.resolvePath("UKA");
_appDir.browseForOpen("Select your video to load")
_appDir.addEventListener(Event.SELECT,onSelected)
}
protected function onSelected(evt:Event):void
{
trace(">>Main:onSelected--",_appDir.nativePath)
_vidSource = _appDir.nativePath;
_vidDisplay.play();
}
protected function onSplashComplete(evt:VideoEvent):void
{
trace(">>Main:onSplashComplete--", _appDir.nativePath)
_vidDisplay.removeEventListener(VideoEvent.COMPLETE,onSplashComplete)
_vidSource = _appDir.nativePath;
_vidDisplay.source = _vidSource;
_vidDisplay.play();
}
]]>
</mx:Script>
</mx:WindowedApplication>
best wishes,
Robert Eastham
Copy link to clipboard
Copied
can u how to save the video in flex 3
Copy link to clipboard
Copied
Chris and Karunaprabhu,
I have found the answer to my issue.
In my method:
protected function onSplashComplete(evt:VideoEvent):void
{
trace(">>Main:onSplashComplete--", _appDir.url)
_vidDisplay.removeEventListener(VideoEvent.COMPLETE,onSplashComplete)
_vidSource = _appDir.nativePath;
_vidDisplay.source = _vidSource;
_vidDisplay.play();
}
I was referencing nativePath as the file reference for the VideoDisplay to read. This works fine on windows but the Mac doesnt like it.
The prefered var is 'url' as both Windows and Mac can read this. The correct method can be seen below:
protected function onSplashComplete(evt:VideoEvent):void
{
trace(">>Main:onSplashComplete--", _appDir.url)
_vidDisplay.removeEventListener(VideoEvent.COMPLETE,onSplashComplete)
_vidSource = _appDir.url;
_vidDisplay.source = _vidSource;
_vidDisplay.play();
}
A small but very important difference.
Thanks you to you guys for taking the time to look at this one but for anyone elso who is having the same problem with video not playing on the Mac, use 'url' not 'nativePath'.
Its also worth mentioning here that it is great that Adobe supports developers in such a personalised manor.
Adobe rocks - and so do you guys - Chris and Karunaprabhu!
Copy link to clipboard
Copied
Hi Robert,
Very glad to hear you were able to figure this out. Thank you for letting us know and double thanks for posting the code so that others can benefit!
Chris