| 31 |
import mx.events.FlexEvent; |
import mx.events.FlexEvent; |
| 32 |
import mx.events.VideoEvent; |
import mx.events.VideoEvent; |
| 33 |
import mx.formatters.DateFormatter; |
import mx.formatters.DateFormatter; |
| 34 |
|
import mx.formatters.NumberFormatter; |
| 35 |
|
|
| 36 |
import org.libspark.utils.ForcibleLoader; |
import org.libspark.utils.ForcibleLoader; |
| 37 |
import org.mineap.nicovideo4as.MyListLoader; |
import org.mineap.nicovideo4as.MyListLoader; |
| 177 |
|
|
| 178 |
private var isSwfConverting:Boolean = false; |
private var isSwfConverting:Boolean = false; |
| 179 |
|
|
|
private var streamingProgressCount:int = 0; |
|
|
|
|
| 180 |
private var streamingProgressTimer:Timer = null; |
private var streamingProgressTimer:Timer = null; |
| 181 |
|
|
| 182 |
private var _videoID:String = null; |
private var _videoID:String = null; |
| 203 |
|
|
| 204 |
private var nicoRelationInfoLoader:ApiGetRelation = null; |
private var nicoRelationInfoLoader:ApiGetRelation = null; |
| 205 |
|
|
| 206 |
|
private var lastLoadedBytes:Number = 0; |
| 207 |
|
|
| 208 |
[Embed(source="/player/NNDDicons_play_20x20.png")] |
[Embed(source="/player/NNDDicons_play_20x20.png")] |
| 209 |
private var icon_Play:Class; |
private var icon_Play:Class; |
| 210 |
|
|
| 342 |
streamingProgressTimer.stop(); |
streamingProgressTimer.stop(); |
| 343 |
streamingProgressTimer = null; |
streamingProgressTimer = null; |
| 344 |
} |
} |
|
streamingProgressCount = 0; |
|
| 345 |
|
|
| 346 |
playingJihou = null; |
playingJihou = null; |
| 347 |
|
|
| 358 |
this.lastFrame = 0; |
this.lastFrame = 0; |
| 359 |
this.lastNicowariFrame = 0; |
this.lastNicowariFrame = 0; |
| 360 |
|
|
| 361 |
|
this.lastLoadedBytes = 0; |
| 362 |
|
|
| 363 |
if(videoInfoView != null){ |
if(videoInfoView != null){ |
| 364 |
videoInfoView.pubUserLinkButtonText = "(未取得)"; |
videoInfoView.pubUserLinkButtonText = "(未取得)"; |
| 365 |
videoInfoView.pubUserNameIconUrl = null; |
videoInfoView.pubUserNameIconUrl = null; |
| 437 |
streamingProgressTimer.stop(); |
streamingProgressTimer.stop(); |
| 438 |
streamingProgressTimer = null; |
streamingProgressTimer = null; |
| 439 |
} |
} |
|
streamingProgressCount = 0; |
|
| 440 |
|
|
| 441 |
this.videoPlayer.label_playSourceStatus.text = "Streaming:0% "; |
this.videoPlayer.label_playSourceStatus.text = "Streaming:0%"; |
| 442 |
videoInfoView.connectionType = "Streaming"; |
videoInfoView.connectionType = "Streaming"; |
| 443 |
streamingProgressTimer = new Timer(200); |
streamingProgressTimer = new Timer(500); |
| 444 |
streamingProgressTimer.addEventListener(TimerEvent.TIMER, streamingProgressHandler); |
streamingProgressTimer.addEventListener(TimerEvent.TIMER, streamingProgressHandler); |
| 445 |
streamingProgressTimer.start(); |
streamingProgressTimer.start(); |
| 446 |
|
|
| 1740 |
return value; |
return value; |
| 1741 |
} |
} |
| 1742 |
|
|
| 1743 |
|
|
| 1744 |
|
/** |
| 1745 |
|
* ストリーミングのダウンロード速度をMB/sで返します。 |
| 1746 |
|
* @return |
| 1747 |
|
* |
| 1748 |
|
*/ |
| 1749 |
|
public function getStreamingSpeed():Number |
| 1750 |
|
{ |
| 1751 |
|
|
| 1752 |
|
// timerから1000msごとに呼ばれる |
| 1753 |
|
|
| 1754 |
|
var value:Number = 0; |
| 1755 |
|
if (isStreamingPlay) |
| 1756 |
|
{ |
| 1757 |
|
if(videoDisplay != null){ |
| 1758 |
|
value = videoDisplay.bytesLoaded - this.lastLoadedBytes; |
| 1759 |
|
this.lastLoadedBytes = videoDisplay.bytesLoaded; |
| 1760 |
|
}else if(loader != null && loader.contentLoaderInfo != null){ |
| 1761 |
|
value = loader.contentLoaderInfo.bytesLoaded - this.lastLoadedBytes; |
| 1762 |
|
this.lastLoadedBytes = loader.contentLoaderInfo.bytesLoaded; |
| 1763 |
|
}else{ |
| 1764 |
|
return value; |
| 1765 |
|
} |
| 1766 |
|
|
| 1767 |
|
trace(value); |
| 1768 |
|
|
| 1769 |
|
//MBに直す |
| 1770 |
|
value = value / 1000000; |
| 1771 |
|
|
| 1772 |
|
// MB/sに直す |
| 1773 |
|
value = value / 1; |
| 1774 |
|
} |
| 1775 |
|
else |
| 1776 |
|
{ |
| 1777 |
|
// 何もしない |
| 1778 |
|
} |
| 1779 |
|
|
| 1780 |
|
return value; |
| 1781 |
|
|
| 1782 |
|
} |
| 1783 |
|
|
| 1784 |
/** |
/** |
| 1785 |
* |
* |
| 1786 |
* @return |
* @return |
| 1807 |
private function streamingProgressHandler(event:TimerEvent):void{ |
private function streamingProgressHandler(event:TimerEvent):void{ |
| 1808 |
if(isStreamingPlay){ |
if(isStreamingPlay){ |
| 1809 |
var value:int = getStreamingProgress(); |
var value:int = getStreamingProgress(); |
| 1810 |
|
var speed:Number = getStreamingSpeed(); |
| 1811 |
if(value >= 100){ |
if(value >= 100){ |
| 1812 |
this.videoPlayer.label_playSourceStatus.text = "Streaming:100%"; |
this.videoPlayer.label_playSourceStatus.text = "Streaming:100%"; |
|
streamingProgressCount = 0; |
|
| 1813 |
videoPlayer.videoController.resetStatusAlpha(); |
videoPlayer.videoController.resetStatusAlpha(); |
| 1814 |
if(streamingProgressTimer != null){ |
if(streamingProgressTimer != null){ |
| 1815 |
streamingProgressTimer.stop(); |
streamingProgressTimer.stop(); |
| 1847 |
|
|
| 1848 |
}else{ |
}else{ |
| 1849 |
|
|
| 1850 |
var str:String = " "; |
var formatter:NumberFormatter = new NumberFormatter(); |
| 1851 |
if(streamingProgressCount <= 10){ |
formatter.precision = 2; |
| 1852 |
str = ". "; |
var str:String = formatter.format(speed) + "MB/s" |
|
}else if(streamingProgressCount > 10 && streamingProgressCount <= 20){ |
|
|
str = ".. "; |
|
|
}else if(streamingProgressCount > 20 && streamingProgressCount <= 30){ |
|
|
str = "..."; |
|
|
} |
|
| 1853 |
|
|
| 1854 |
this.videoPlayer.label_playSourceStatus.text = "Streaming:" + value + "%" + str; |
this.videoPlayer.label_playSourceStatus.text = "Streaming:" + value + "% (" + str + ")"; |
|
if(streamingProgressCount >= 30){ |
|
|
streamingProgressCount = 0; |
|
|
}else{ |
|
|
streamingProgressCount = streamingProgressCount + 2; |
|
|
} |
|
| 1855 |
} |
} |
| 1856 |
}else{ |
}else{ |
| 1857 |
if(streamingProgressTimer != null){ |
if(streamingProgressTimer != null){ |