首页 \ 问答 \ Flash视频播放器内存问题(Flash Video player memory issue)

Flash视频播放器内存问题(Flash Video player memory issue)

我用播放列表制作了一个视频播放器。 大约45分钟后声音停止! 视频继续播放。 我播放短片(每个约3到4分钟)。

播放器基于2帧:

第1帧使用文件名定义变量VidReference:

VidReference = trackToPlay;

第2帧播放视频:

var nc:NetConnection = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
const buffer_time:Number = 2;
ns.bufferTime = buffer_time;
ns.client = this;
ns.play(VidReference);
var vid:Video = new Video();
vid.attachNetStream(ns);
addChild(vid);
vid_frame.addChild(vid);

一旦视频完成播放,它将进入第1帧(将新值放入VidReference变量)并返回第2帧以播放新视频。 我是否应该在每次加载新视频时删除视频对象? 我每次循环(第1帧>第2帧)并将每个视频添加到RAM中时,我是否实际声明了一个新的视频对象,最终压倒了Flash播放器?

我听说过垃圾收集,但我不知道如何删除视频对象,以便从内存中清除它(以及视频本身)。

当我检查System.totalMemory它每次加载新视频时都会加起来,我无法弄清楚如何从内存中删除旧视频。


I made a video player with a playlist. After around 45 min the sound stops! The video continues playing. I play short clips (about 3 to 4 min each).

The player is based on 2 frames:

Frame 1 defines the variable VidReference with the filename:

VidReference = trackToPlay;

Frame 2 plays the video:

var nc:NetConnection = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
const buffer_time:Number = 2;
ns.bufferTime = buffer_time;
ns.client = this;
ns.play(VidReference);
var vid:Video = new Video();
vid.attachNetStream(ns);
addChild(vid);
vid_frame.addChild(vid);

Once the video is done playing it goes to Frame 1 (to put the new value to the VidReference variable) and goes back to frame 2 to play the new video. Am I supposed to delete the video object each time it loads a new video? Am I actually declaring a new video object each time I'm looping (frame 1 > 2) and adding each video to the RAM, and in the end overwhelming the flash player?

I've heard about garbage collecting but I wouldn't know how to delete the video object so it is cleared (and the video itself too) from the memory.

When I check System.totalMemory it's adding up each time a new video is loaded, I can't figure out how to delete old videos from the memory.


原文:https://stackoverflow.com/questions/5670602
更新时间:2022-11-22 13:11

最满意答案

我相信你可以在块中启用缓存http://api.rubyonrails.org/classes/ActiveRecord/QueryCache/ClassMethods.html#method-i-cache

task your_rake_task: :environment do
  ActiveRecord::Base.connection.cache do
    # should cache queries inside the block
  end
end

I believe you can enable the cache in a block http://api.rubyonrails.org/classes/ActiveRecord/QueryCache/ClassMethods.html#method-i-cache

task your_rake_task: :environment do
  ActiveRecord::Base.connection.cache do
    # should cache queries inside the block
  end
end

相关问答

更多

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)