' ' Copyright (C) 2001-2003 Xinics Inc. All rights reserved ' Const MSG_1 = "以前に見た内容です." Const MSG_2 = "から続けて見ますか?" Const MSG_3 = "続けて見る" Const MSG_4 = "視聴しているときだけメモが可能です." Const MSG_5 = "板書を読み取れませんでした." Const MSG_6 = "ストリームノートが設置されていません." Const MSG_7 = "メディアプレーヤーが設置されていません." Const Msg_8 = "Contentsを視聴するためのコンポーネントがインストールされていませんので、ViewerOCX.exeのインストールを開始します。" Const MSG_LOG1 = "サーバーへの接続に失敗しました。学習時間が記録されていません." Const MSG_LIVE1 = "生放送が進行しているときだけ質問が可能です." Const MSG_LIVE2 = "生放送講義サーバーへの接続に失敗しました." Const MSG_LIVE3 = "生放送講義サーバーへの接続に失敗しました。板書が表示されません." Const MSG_LIVE4 = "生放送が終了しました." Const MSG_LIVE5 = "生放送がすでに進行中です." Const MSG_LIVE6 = "ページです." Const MSG_LIVE7 = "生放送がまだ始まっていません." Const MSG_LIVE8 = "生放送が始まりました." Const BufText = "バッファリング中です..." Const BufText2 = "バッファリング" Const gInc = 100 Dim gCurListIndex,gListNum 'Array index - 1:posLeft, 2:posTop, 3:posWidth, posHeight:4 Dim gNormalWindow(2), gTitleBar(2) Dim gSlideRect(4),gVideoRect(4), gInitSlideRect(4), gInitVideoRect(4) Dim gSlideControlRect(4),gSlideControlRect2(4),gNoteRect(4),gNoteRect2(4) Dim gVideoControlRect(4),gVideoControlRect2(4),gMuteRect(4),gMuteRect2(4) Dim gEllapseRect(4),gEllapseRect2(4) Dim gTrackRect(4),gTrackRect2(4),gTrackPosRect(4),gTrackPosRect2(4) ' Dim gBgVideoBoxPos(2), gBgContentsBoxPos(2), gBgSlideBoxPos(2) Dim gTopLogoPos(2), gTitleVideoPos(2), gTitleSlidePos(2), gTitleContentsPos(2) Dim gVideoTablePos(2), gSlideTablePos(2), gListTablePos(2), gPageTablePos(2) Dim gHLine1Pos(2), gHLine2Pos(2), gHLine3Pos(2), gHLine4Pos(2), gHLine5Pos(2) Dim gVLine1Pos(2), gVLine2Pos(2), gVLine3Pos(2), gVLine4Pos(2), gBgTopPos(2), gBgBottomPos(2) Dim gListPos(2), gPagePos(2), gInfoPos(2) Dim gQuestionPos(2), gSwapPos(2), gVideoMaxPos(2), gSlideMaxPos(2), gPrintPos(2), gHelpPos(2) Dim gIsLiveFirstTry Dim gPrevMarker Dim gMarkers() Dim gMarkerNum Dim gLateMarker Dim gGUID Dim gLiveOn Dim gLoggingOn Dim gbMP7 Dim gDataVideo Dim bWindowLoaded, bPlayReady Sub window_onload() SetSync False ShowToolTip MyInitLayers if LiveMode then ShowLayer Question ' ShowLayer bg_LiveLine HideLayer TrackPos ' ShowInfo gListNum = InitListLive() gCurListIndex = 1 ShowSlideNumber gCurListIndex if not ViewerUtil.LiveConnect (LiveIP, LiveChannel) then msgbox MSG_LIVE2, 16 else if sn2.Connect( LiveIP, LiveChannel, False ) <> 0 then msgbox MSG_LIVE3, 16 end if end if gIsLiveFirstTry = True ViewerUtil.LiveGetInfo else gListNum = InitListNew() ' SetInterval "SetVideoElapseTime()", 1000 end if ' If (not gbMP7) and isObj(td_Video) Then td_Video.style.posHeight = td_Video.style.posHeight + 9 initColors UpdateSize bWindowLoaded = True If (bPlayReady = True) Then PlayReady End Sub Sub window_onresize() UpdateSize End Sub Sub OnOpenStateChangeMP6( lOldState, lNewState ) if not gbMP7 and lNewState = 6 then PlayReady End Sub Sub OnOpenStateChangeMP7( openState ) If gbMP7 and openState = 13 then PlayReady End Sub Sub PlayReady() If (bWindowLoaded <> True) Then bPlayReady = True Exit Sub End If bPlayReady = False ' Seere If (gbMP7) Then imgWidth = MediaPlayer1.currentMedia.imageSourceWidth Else imgWidth = MediaPlayer1.ImageSourceWidth End If If LiveMode Then Redim gMarkers(gInc) gMarkerNum = 1 gMarkers(gMarkerNum) = LiveMarker( 1 ) gLateMarker = -1 If (imgWidth = 0) Then showAudioLogo Else If gListNum = "" Then gListNum = InitListNew () If gListNum = 0 Then gListNum = InitList() gCurListIndex = 1 ShowSlideNumber gCurListIndex ShowInfo gIsLoadEst = LoadEst() If (imgWidth = 0) Then showAudioLogo gSkipPos = 0 if gIsLoadEst then gGUID = sn2.GetGUID ViewerUtil.NoteLoad gGUID gSkipPos = SkipPosition() else MsgBox MSG_5 end if if gIsLoadEst and gSkipPos > 0 then MP_SetCurrentPosition gSkipPos StartTimer gEventCur End If dim interval, dur if LiveMode then dur = 0 else dur = MP_Duration() end if if LogMode then interval = ViewerUtil.LogCreateSession( LogIp, ClientID, ClientName, L_Code, L_contentTITLE, dur ) if interval > 0 then SetInterval "Viewing()", interval * 1000 gLoggingOn = True else gLoggingOn = False ' msgbox MSG_LOG1 end if end if sn2.strStatusText = "---" End Sub Sub DoEvent(mn) if LiveMode then exit sub if Not gSnReady then exit sub If gIsSync Then exit sub If LCase(Left(mn,13)) = "anizoom slide" then DoZoom 1 ElseIf LCase(Left(mn,13)) = "anizoom video" then DoZoom 2 ElseIf LCase(Left(mn,8)) = "maxslide" then SlideMax_onClick() ElseIf LCase(Left(mn,8)) = "maxvideo" then VideoMax_onClick() ' ElseIf LCase(Left(mn,7)) = "aniswap" then ' Swap1_OnClick ElseIf LCase(Left(mn,7)) = "hideall" then sn2.HideAllObjects ElseIf LCase(Left(mn,3)) = "ani" Then sn2.execScript "DocAction()", "JavaScript" sn2.ReserveDelayedUpdate ElseIf LCase(Left(mn,4)) = "note" Then SetTimeout "ReserveScrollBar()", 1000 objs = Mid( mn, InStrRev( mn, "*" )+1, 50 ) PlayObjects objs, True, gDataVideo ElseIf LCase(Left(mn,5)) = "slide" Then ListIndex = GetListIndex(gEventCur-1) GotoSlide ListIndex, mn, "", "LISTSCROLL" End If End Sub Sub OnScriptCommand(sType, sParam) if gClosed then exit sub if LCase(sType) = "text" then CaptionLayer.innerHTML = sParam exit sub end if if not LiveMode then exit sub if not gSnReady then exit sub gMarkerNum = gMarkerNum + 1 if gMarkerNum mod gInc = 0 then Redim Preserve gMarkers( gInc * (CInt(gMarkerNum/gInc) + 1) ) end if gMarkers(gMarkerNum) = sParam If gIsSync Then exit sub mn = gMarkers(gMarkerNum) If LCase(Left(mn,13)) = "anizoom slide" then DoZoom 1 ElseIf LCase(Left(mn,13)) = "anizoom video" then DoZoom 2 ElseIf LCase(Left(mn,8)) = "maxslide" then SlideMax_onClick() ElseIf LCase(Left(mn,8)) = "maxvideo" then VideoMax_onClick() ' ElseIf LCase(Left(mn,7)) = "aniswap" then ' Swap1_OnClick ElseIf LCase(Left(mn,7)) = "hideall" then sn2.HideAllObjects ElseIf LCase(Left(mn,3)) = "ani" Then sn2.execScript "DocAction()", "JavaScript" sn2.ReserveDelayedUpdate ElseIf LCase(Left(mn,4)) = "note" Then objs = Mid( mn, InStrRev( mn, "*" )+1, 50 ) PlayObjects objs, True, gDataVideo ElseIf LCase(Left(mn,5)) = "slide" Then ListIndex = GetListIndex(gEventCur-1) GotoSlide ListIndex, mn, "", "LISTSCROLL" End If End Sub Sub OnPlayStateChange(playState) if gClosed then exit sub if not gbMP7 then playState = playState + 1 if playState = 1 and gListNum = gCurListIndex and gQuizOnNextPage and not IsVideoFull() then QuizMarker = Right( gPrevMarker, Len(gPrevMarker)-InStrRev( gPrevMarker, "@" ) ) & "," DoQuiz QuizMarker gQuizOnNextPage = False end if if LiveMode and playState = 1 and not gClosed then 'mpStopped gLiveOn = False msgbox MSG_LIVE4, 64 if not ViewerUtil.LiveConnect (LiveIP, LiveChannel) then msgbox MSG_LIVE2, 16 end if end if if playState = 3 then 'mpPlaying StartTimer gEventCur if gLoggingOn then ViewerUtil.LogResume elseif playState = 1 then 'mpStopped gIgnoreOnce = True MP_SetCurrentPosition 0 clearTimeout gEventTimeoutId gEventCur = 0 if gLoggingOn then ViewerUtil.LogPause elseif playState = 2 then 'mpPaused clearTimeout gEventTimeoutId if gLoggingOn then ViewerUtil.LogPause end if End Sub Sub window_onunload() gClosed = True gQuizOnNextPage = False if LogMode And gLoggingOn then ViewerUtil.LogEnd DelCookie "ESTREAM" & gGUID SetCookie "ESTREAM" & gGUID, MP_CurrentPosition(), 365 If gIsLoadEst Then ViewerUtil.NoteSetMarkers gCurListIndex, gPMarkers gNoteDirty = True End If If gIsLoadEst and gNoteDirty Then ViewerUtil.NoteSetTitle gLectureTitle, gLectureAuthor, gLectureDate ViewerUtil.NoteSave sn2.SavePrivateFile gGUID & ".est" End If If ( IsOpenWindow(window.opener) ) Then window.opener.focus() End Sub Sub OnPositionChange(oldPosition, newPosition) if gIgnoreOnce then gIgnoreOnce = False exit sub end if if LiveMode then exit sub if gIsSync then SetSync False Dim ListIndex, mn FindCurrentSlide ListIndex, mn gEventCur = GetCurrentEvent(newPosition*1000) StartTimer gEventCur GotoSlide ListIndex, mn, "", "LISTSCROLL" End Sub Sub Print_onClick() if not gSnReady then exit sub sn2.execScript "DoPrint()", "JavaScript" End Sub Sub Help_onClick() DoHelp End Sub Sub Play_onClick() MP_Play End Sub Sub Pause_onClick() MP_Pause End Sub Sub Stop_onClick() If not LiveMode then MP_SetCurrentPosition 0 MP_Stop end if End Sub Sub Mute_onClick() if gbMP7 then MediaPlayer1.settings.mute = not MediaPlayer1.settings.mute b = MediaPlayer1.settings.mute else MediaPlayer1.Mute = not MediaPlayer1.Mute b = MediaPlayer1.Mute End if if b then Sound.src = "images/SoundOff.gif" else Sound.src = "images/button_Sound.gif" end if End Sub Sub Next_onclick() if gCurListIndex >= gListNum then exit sub if not gIsSync then SetSync True if LiveMode then MarkerText = LiveMarker( gCurListIndex ) GotoSlide -1, MarkerText, "ShowAllPage", "" exit sub end if m = GetMarkerIndex( gCurListIndex+1 ) mn = GetEventItem(m) GotoSlide gCurListIndex+1, mn, "ShowAllPage", "LISTSCROLL" End Sub Sub Prev_onclick() if gCurListIndex <= 1 then exit sub if not gIsSync then SetSync True if LiveMode then MarkerText = LiveMarker( gCurListIndex ) GotoSlide -1, MarkerText, "ShowAllPage", "" exit sub end if m = GetMarkerIndex( gCurListIndex-1 ) mn = GetEventItem(m) GotoSlide gCurListIndex-1, mn, "ShowAllPage", "LISTSCROLL" End Sub Sub Sync_onclick() if not gIsSync then exit sub SetSync False if LiveMode then for index=1 to gMarkerNum if LCase(Left(gMarkers(index),5)) = "slide" then MarkerText = gMarkers(index) end if next GotoSlide -1, MarkerText, "", "LISTSCROLL" else Dim ListIndex, mn FindCurrentSlide ListIndex, mn GotoSlide ListIndex, mn, "", "LISTSCROLL" gEventCur = GetCurrentEvent( MP_CurrentPosition() * 1000 ) StartTimer gEventCur end if End Sub Sub Pen_onClick() If ( not CheckSN() ) Then Exit Sub If ( sn2 = "" ) Then Exit Sub if gPenMode then sn2.StopRecord else sn2.StartRecord True sn2.StartPrivateRecord end if gPenMode = not gPenMode sn2.PutProp -1, "bTranslucent", False cr = Trim(PenColor.value) if Left(cr,1) = "#" then cr = "&H" & Right( cr, Len(cr)-1 ) & "&" sn2.PutProp -1, "color", Eval( cr ) else sn2.PutProp -1, "color", CInt(cr) end if sn2.PutProp -1, "penWidth", CInt(PenWidth.value)*2 End Sub Sub PenColor_onChange() If ( not CheckSN() ) Then Exit Sub If ( sn2 = "" ) Then Exit Sub cr = Trim(PenColor.value) if Left(cr,1) = "#" then cr = "&H" & Right( cr, Len(cr)-1 ) & "&" sn2.PutProp -1, "color", Eval( cr ) else sn2.PutProp -1, "color", CInt(cr) end if sn2.focus End Sub Sub PenWidth_onChange() If ( not CheckSN() ) Then Exit Sub If ( sn2 = "" ) Then Exit Sub sn2.PutProp -1, "penWidth", CInt(PenWidth.value)*2 sn2.focus End Sub Sub Memo_onClick() if gIsLoadEst then ViewerUtil.MemoLoad gGUID, gCurListIndex, window.event.screenX, window.event.screenY gNoteDirty = True else msgbox MSG_4, 16 end if End Sub Sub Swap_OnClick() If gZoomState = 1 Then DoZoom 2 Else DoZoom 1 End If SetTimeout "ReserveScrollBar()", 1000 End Sub Sub DoZoom(state) offsetX = getStartPos("w") offsetY = getStartPos("h") ' if gIsSlideFull or IsVideoFull() then exit sub if IsVideoFull() then MP_Fullscreen False if gIsSlideFull then SlideNormal_onClick if state = gZoomState then exit sub gZoomState = state LoadRect VideoLogoLayer, gSlideRect LoadRect VideoLogo, gSlideRect If gbMP7 Then h = 64 Else h = 73 End If gSlideRect(4) = gSlideRect(4) + h LoadRect MediaPlayer1, gSlideRect LoadRect VideoLayer, gSlideRect gSlideRect(4) = gSlideRect(4) - h gVideoRect(4) = gVideoRect(4) - h LoadRect SlideLayer, gVideoRect gVideoRect(4) = gVideoRect(4) + h If state = 1 then LoadRect VideoControl, gVideoControlRect LoadRect Ellapse, gEllapseRect LoadRect MuteLayer, gMuteRect gSlideControlRect(1) = gSlideControlRect(1) + offsetX gSlideControlRect(2) = gSlideControlRect(2) + offsetY LoadRect SlideControl, gSlideControlRect gSlideControlRect(1) = gSlideControlRect(1) - offsetX gSlideControlRect(2) = gSlideControlRect(2) - offsetY gNoteRect(1) = gNoteRect(1) + offsetX gNoteRect(2) = gNoteRect(2) + offsetY LoadRect NoteLayer, gNoteRect gNoteRect(1) = gNoteRect(1) - offsetX gNoteRect(2) = gNoteRect(2) - offsetY LoadRect Track, gTrackRect LoadRect TrackPos, gTrackPosRect If IsObj(td_Slide) AND (not gbMP7) Then td_Video.style.posHeight = td_Video.style.posHeight + 9 td_Slide.style.posHeight = td_Slide.style.posHeight - 9 End If If IsObj(tit_Slide) Then tit_Slide.src = "images\tit_Slide.gif" If IsObj(tit_Video) Then tit_Video.src = "images\tit_Video.gif" If (bHideTitle) Then ShowLayer SlideTitle else LoadRect VideoControl, gVideoControlRect2 LoadRect Ellapse, gEllapseRect2 LoadRect MuteLayer, gMuteRect2 gSlideControlRect2(1) = gSlideControlRect2(1) + offsetX gSlideControlRect2(2) = gSlideControlRect2(2) + offsetY LoadRect SlideControl, gSlideControlRect2 gSlideControlRect2(1) = gSlideControlRect2(1) - offsetX gSlideControlRect2(2) = gSlideControlRect2(2) - offsetY gNoteRect2(1) = gNoteRect2(1) + offsetX gNoteRect2(2) = gNoteRect2(2) + offsetY LoadRect NoteLayer, gNoteRect2 gNoteRect2(1) = gNoteRect2(1) - offsetX gNoteRect2(2) = gNoteRect2(2) - offsetY LoadRect Track, gTrackRect2 LoadRect TrackPos, gTrackPosRect2 If IsObj(td_Slide) AND (not gbMP7) Then td_Video.style.posHeight = td_Video.style.posHeight - 9 td_Slide.style.posHeight = td_Slide.style.posHeight + 9 End If If IsObj(tit_Slide) Then tit_Slide.src = "images\tit_Video.gif" If IsObj(tit_Video) Then tit_Video.src = "images\tit_Slide.gif" If (bHideTitle) Then HideLayer SlideTitle End if SaveRect gSlideRect, SlideLayer SaveRect gVideoRect, VideoLayer If IsObj(SlideTitle) Then SlideTitle.style.posLeft = SlideLayer.style.posLeft SlideTitle.style.posTop = SlideLayer.style.posTop + SlideLayer.style.posHeight + 1 SlideTitle.style.posWidth = SlideLayer.style.posWidth End If End Sub Sub List_onClick( ListIndex ) if LiveMode then MarkerText = LiveMarker( ListIndex ) GotoSlide -1, MarkerText, "ShowAllPage", "" if not gIsSync then SetSync True exit sub end if ' if ListIndex <> gCurListIndex then m = GetMarkerIndex( ListIndex ) gEventCur = m+1 mn = GetEventItem(m) gIgnoreOnce = True MP_SetCurrentPosition GetEventTime(m)/1000.0 + 0.5 StartTimer gEventCur if gIsSync then SetSync False GotoSlide ListIndex, mn, "", "" ' end if End Sub Sub SlideMax_onClick() if gIsSlideFull then exit sub if IsVideoFull() then MP_Fullscreen False gIsSlideFull = True gNormalWindow(1) = document.body.clientWidth - 2 gNormalWindow(2) = document.body.clientHeight - 2 ScreenWidth = screen.availWidth ScreenHeight = screen.availHeight window.top.moveTo 0,0 window.top.resizeTo ScreenWidth, ScreenHeight wx = window.screenLeft wy = window.screenTop gTitleBar(1) = (wx+3) * 2 '12 gTitleBar(2) = wy + 2 * (wx+1) + 1 '31 'MsgBox document.body.clientWidth & " : " & screen.availWidth ScreenWidth = ScreenWidth - gTitleBar(1) ScreenHeight = ScreenHeight - gTitleBar(2) ControlPos = ScreenWidth - bgSlideControl.style.posWidth Dim TempRect(4) TempRect(1) = 12 TempRect(2) = 0 TempRect(3) = ControlPos - TempRect(1) TempRect(4) = ScreenHeight - 73 LoadRect SlideLayer, TempRect TempRect(2) = ScreenHeight - 74 '-1 If gbMP7 Then TempRect(4) = 65 '+1 Else TempRect(4) = 74 '+1 End If LoadRect VideoLayer, TempRect LoadRect MediaPlayer1, TempRect If (not bHideSlideControl) Then bgSlideControl.style.posLeft = ControlPos ShowLayer bgSlideControl SlideControl.style.posTop = 13 SlideControl.style.posLeft = ControlPos + 14 End If SlideNormal.style.posTop = ScreenHeight - SlideNormal.style.posHeight - 20 SlideNormal.style.posLeft = ControlPos + 40 ShowLayer SlideNormal HideLayer TopLayer HideLayer LeftLayer HideLayer RightLayer HideLayer VideoControl HideLayer MuteLayer HideLayer Track HideLayer TrackPos HideLayer ListLayer HideLayer PageLayer HideLayer VideoLogoLayer HideLayer PenColor HideLayer PenWidth HideLayer VideoMax HideLayer SlideMax HideLayer Question HideLayer Swap HideLayer PrintBtn HideLayer Help HideLayer NoteLayer HideLayer TopButton HideLayer SlideTitle HideLayer Info ' HideLayer ViewerBorder HideLayer bg_HLine1 HideLayer bg_HLine2 HideLayer bg_HLine3 HideLayer bg_HLine4 HideLayer bg_VLine1 HideLayer bg_VLine2 HideLayer bg_LiveLine SetTimeout "ReserveScrollBar()", 1000 End Sub Sub VideoMax_onClick() MP_Fullscreen True if gIsSlideFull then SlideNormal_onClick End Sub Sub SlideNormal_onClick() offsetX = getStartPos("w") offsetY = getStartPos("h") ShowLayer TopLayer ShowLayer LeftLayer ShowLayer RightLayer ShowLayer VideoControl ShowLayer MuteLayer ShowLayer Track ShowLayer TrackPos ShowLayer SlideControl ShowLayer ListLayer ShowLayer PageLayer ShowLayer VideoLogoLayer ShowLayer VideoLayer ShowLayer PenColor ShowLayer PenWidth ShowLayer VideoMax ShowLayer SlideMax ShowLayer Swap ShowLayer NoteLayer ShowLayer TopButton If not (bHideTitle AND gZoomState = 2) Then ShowLayer SlideTitle End If ShowLayer Info ' ShowLayer PrintBtn ShowLayer Help ShowLayer ViewerBorder ShowLayer bg_HLine1 ShowLayer bg_HLine2 ShowLayer bg_HLine3 ShowLayer bg_HLine4 ShowLayer bg_VLine1 ShowLayer bg_VLine2 ShowLayer Buttons If (LiveMode) Then ShowLayer bg_LiveLine ShowLayer Question End If gIsSlideFull = False HideLayer SlideNormal HideLayer bgSlideControl window.top.resizeTo gNormalWindow(1) + gTitleBar(1), gNormalWindow(2) + gTitleBar(2) ' SlideLayer.style.posWidth = 0 ' SlideLayer.style.posHeight = 0 LoadRect MediaPlayer1, gVideoRect If (gZoomState = 2) Then gSlideControlRect2(1) = gSlideControlRect2(1) + offsetX gSlideControlRect2(2) = gSlideControlRect2(2) + offsetY LoadRect SlideControl, gSlideControlRect2 gSlideControlRect2(1) = gSlideControlRect2(1) - offsetX gSlideControlRect2(2) = gSlideControlRect2(2) - offsetY Else gSlideControlRect(1) = gSlideControlRect(1) + offsetX gSlideControlRect(2) = gSlideControlRect(2) + offsetY LoadRect SlideControl, gSlideControlRect gSlideControlRect(1) = gSlideControlRect(1) - offsetX gSlideControlRect(2) = gSlideControlRect(2) - offsetY End If LoadRect VideoLayer, gVideoRect LoadRect SlideLayer, gSlideRect SetTimeout "ReserveScrollBar()", 1000 End Sub Sub Restore() if gIsSlideFull then SlideNormal_onClick if IsVideoFull() then MP_Fullscreen False End Sub Sub Eraser_onClick() If ( not CheckSN() ) Then Exit Sub If ( sn2 = "" ) Then Exit Sub sn2.HideAllObjects objs = gPMarkers & "," pos = InStr( objs, "," ) while pos <> 0 t = Left( objs, pos-1 ) if t<>"" then sn2.DeleteObject CLng(t) objs = Right( objs, len(objs)-pos ) pos = InStr( objs, "," ) wend gPMarkers = "" if LiveMode then SlideIndex = gCurListIndex else ListIndex = 0 m = GetMarkerIndex( gCurListIndex ) SlideIndex = GetSlideIndex( GetEventItem(m) ) end if objs = PlayRange(SlideIndex, False) DoSlideObject( SlideIndex ) PlayObjects objs, False End Sub Sub Question_OnClick() if not gLiveOn then MsgBox MSG_LIVE1, 48 exit sub end if ret = ShowModalDialog( "ques.htm", "", "dialogWidth:443px;dialogHeight:190px;resizable:no;scroll:no;status:no" ) if ret <> "" then ViewerUtil.LiveConnect LiveIP, LiveChannel ViewerUtil.LiveQuestion "LQ" & ret ViewerUtil.LiveClose end if End Sub Sub sn2_PacketReceived(id) if gLateMarker >= 0 then if sn2.PlayObject(gLateMarker, False) then gLateMarker = -1 end if end if End Sub Sub sn2_StatusMatched() sn2.strStatusText = "---" MP_Play End Sub Sub sn2_PacketGenEnd( id ) if gPMarkers <> "" then gPMarkers = gPMarkers & "," gPMarkers = gPMarkers & id End Sub Sub ViewerUtil_OnLiveInfo( IsStarted, SlideNum, GUID ) if IsStarted then if SlideNum > 0 and gIsLiveFirstTry then MsgBox MSG_LIVE5 & SlideNum & MSG_LIVE6, 64 Redim gMarkers(gInc) gMarkerNum = 1 gLateMarker = -1 gMarkers(gMarkerNum) = LiveMarker( SlideNum ) GotoSlide -1, LiveMarker( SlideNum ), "", "" end if gGUID = GUID ViewerUtil.LiveClose gLiveOn = True else msgbox MSG_LIVE7, 64 gLiveOn = False end if End Sub Sub ViewerUtil_OnLiveStart() msgbox MSG_LIVE8, 64 Redim gMarkers(gInc) gMarkerNum = 1 gMarkers(gMarkerNum) = LiveMarker( 1 ) gLateMarker = -1 sn2.ResetContent if gIsSync then SetSync False if not gbMP7 and MediaPlayer1.PlayState <> 2 then 'not playing MediaPlayer1.FileName = VideoUrl elseif gbMP7 and MediaPlayer1.PlayState <> 3 then 'not playing MediaPlayer1.URL = VideoUrl end if gIsLiveFirstTry = False ViewerUtil.LiveGetInfo End Sub Sub window_onfocus() If ( not CheckSN() ) Then Exit Sub If ( sn2 = "" ) Then Exit Sub sn2.ReserveDelayedUpdate End Sub Sub ShowToolTip() SetAlt document.all.item("Print"), "Print" SetAlt Help, "HELP" SetAlt SlideMax, "SLIDE FULL SCREEN" SetAlt VideoMax, "VIDEO FULL SCREEN" SetAlt VideoMax,"VIDEO FULL SCREEN" SetAlt Swap, "SWITCH VIDEO/SLIDE" SetAlt Play, "PLAY" SetAlt Pause, "PAUSE" SetAlt document.all.item("Stop"), "STOP" SetAlt Mute, "MUTE" SetAlt Prev, "PREV" SetAlt Sync, "VIDEO/SLIDE SYNC" SetAlt document.all.item("Next"), "NEXT" SetAlt SlideNormal, "CLOSE" Setalt NoteLook, "NOTE ON/OFF" SetAlt MemoLook, "MEMO ON/OFF" SetAlt AnnoLook, "ANNOTATION ON/OFF" Setalt Pen, "PEN" SetAlt Eraser, "ERASER" SetAlt Memo, "MEMO" SetAlt Question, "Question" End Sub Function SkipPosition() SkipPosition = 0 Dim pos pos = GetCookie("ESTREAM" & gGUID) if pos <> "" then t = CInt(pos) if t<10 then exit Function d = FormatTime(t) str = MSG_1 & d & MSG_2 if msgbox( str, 4, MSG_3 ) = 6 then SkipPosition = t end if end if End Function Function PlayRange( SlideIndex, bAnimation ) Dim index, AniNum, bPlay, mn, hideindex, t, objs objs = "" AniNum = 0 bPlay = False hideindex = 0 If LiveMode then toIndex = gMarkerNum Else toIndex = gEventCur End If for index=1 to toIndex if LiveMode then mn = gMarkers(index) else mn = GetEventItem(index-1) end if if LCase(Left(mn,5)) = "slide" then If SlideIndex = GetSlideIndex(mn) then bPlay = True Else bPlay = False End If elseif bPlay = True and LCase(Left(mn,7)) = "hideall" then hideindex = index end if next bPlay = False for index=1 to toIndex if LiveMode then mn = gMarkers(index) else mn = GetEventItem(index-1) end if if LCase(Left(mn,5)) = "slide" then If SlideIndex = GetSlideIndex(mn) then bPlay = True Else bPlay = False End If elseif bPlay = True and LCase(Left(mn,4)) = "note" and index > hideindex then objs = objs & Mid( mn, InStrRev( mn, "*" )+1, 50 ) & "," elseif bPlay = True and LCase(Left(mn,3)) = "ani" and LCase(Left(mn,7)) <> "anizoom" and LCase(Left(mn,7)) <> "aniswap" then AniNum = AniNum + 1 end if next if bAnimation then sn2.execScript "SetAniNum( " & AniNum & ")", "JavaScript" end if if objs <> "" then objs = Left( objs, Len(objs)-1 ) 'window.status = "MPCur=" & toIndex & "," & MP_CurrentMarker() & ",objs=" & objs & ",Aninum=" & AniNum PlayRange = objs End Function Sub Viewing() ViewerUtil.LogViewing End Sub Sub ShowInfo() if not IsObj( info ) then exit sub infoc = Info.innerHTML infoc = Replace( infoc, "", gLectureTitle, 1, -1, 1 ) 'mpClipTitle infoc = Replace( infoc, "", gLectureAuthor, 1, -1, 1 ) 'mpClipAuthor infoc = Replace( infoc, "", gLectureDate, 1, -1, 1 ) 'mpClipRating Info.innerHTML = infoc End Sub Function document_onkeydown() 'if window.event.keycode = 27 then MP_Stop document_onkeydown = False End Function Sub SetSync(v) gIsSync = v clearTimeout gEventTimeoutId MultiMouseOut "Sync", "button_" End Sub Sub GotoSlide( ListIndex, MarkerText, ShowAllPage, ListScroll ) If ( not CheckSN() ) Then Exit Sub If ( sn2 = "" ) Then Exit Sub If IsDataVideo( MarkerText ) and not LiveMode then if Abs(MP_CurrentPosition()-gPrevPosition) < 0.1 then exit sub end if SlideIndex = GetSlideIndex(MarkerText) PrevIndex = gCurListIndex if LiveMode then gCurListIndex = SlideIndex else gCurListIndex = ListIndex end if if gCurListIndex=0 then gCurListIndex = 1 sType = GetSubType( MarkerText ) if sType = 1 or sType = 2 or sType = 5 or sType = 7 then sn2.bScale = False else sn2.bScale = True end if ChangeEntry gCurListIndex, ListScroll ShowSlideNumber gCurListIndex sn2.HideAllObjects title=Left( MarkerText, InStrRev( MarkerText, "*")-1 ) title=Mid( title, InStr( title, "#")+1, Len(title) ) if IsObj(SlideTitle) then SlideTitle.innerText = title If HasAnno(MarkerText) and not IsVideoFull() then DoAnno SlideIndex End if if not LiveMode and not IsVideoFull() and IsObj(NoteLayer) then ViewerUtil.MemoCheck gGUID, gCurListIndex, window.screenLeft+NoteLayer.style.posLeft, window.screenTop+NoteLayer.style.posTop end if If gQuizOnNextPage and not IsVideoFull() then On Error Resume Next if not LiveMode then if gbMP7 then if MediaPlayer1.playState = 6 then gReservePause = True elseif MediaPlayer1.controls.isAvailable("pause") then MP_Pause end if gReservePause = True else MP_Pause end if end if On Error Goto 0 QuizMarker = Right( gPrevMarker, Len(gPrevMarker)-InStrRev( gPrevMarker, "@" ) ) & "," DoQuiz QuizMarker If IsQuiz( MarkerText ) then gPrevMarker = MarkerText gQuizOnNextPage = True else gQuizOnNextPage = False end if end if If IsQuiz( MarkerText ) then gQuizOnNextPage = True gPrevMarker = MarkerText end if gPrevPosition = -1 GetVideoMetadata ListIndex, volume, main_pause if volume = "" then volume = "-1" if IsDataVideo( MarkerText ) and Trim(LCase(main_pause)) <> "yes" Then If not LiveMode and not MP_SourceFile() then MP_Pause sn2.strStatusText = "BufferingEnd" gPrevPosition = MP_CurrentPosition() end if elseif IsDataVideo( MarkerText ) and Trim(LCase(main_pause)) = "yes" Then If not LiveMode then if gbMP7 then if MediaPlayer1.playState = 6 then gReservePause = True elseif MediaPlayer1.controls.isAvailable("pause") then MP_Pause end if gReservePause = True else MP_Pause end if gReservePause = True sn2.strStatusText = "PlayingEnd" end if end if sn2.ReserveDelayedUpdate objs = PlayRange(SlideIndex, True) If IsDataVideo( MarkerText ) Then if ManagerMode then sManager="true" else sManager="false" end if if sType = 5 then 'AppVideo sScale="false" else sScale="true" end if MediaUrl = MP_Url() MediaUrl = Replace( MediaUrl, "\", "/", 1, -1, 1 ) sn2.execScript "DoDataVideo2 (" & SlideIndex & "," & sScale & ",'" & MediaUrl & "'," & volume & "," & sManager & ")", "JavaScript" Else sn2.execScript "setFrames (" & SlideIndex & ", '" & ShowAllPage & "')", "JavaScript" End If SetTimeout "ReserveScrollBar()", 1000 if IsDataVideo( MarkerText ) and Trim(LCase(main_pause)) <> "yes" Then If not LiveMode and not MP_SourceFile() then sn2.strStatusText = "BufferingEnd" end if elseif IsDataVideo( MarkerText ) and Trim(LCase(main_pause)) = "yes" Then If not LiveMode then sn2.strStatusText = "PlayingEnd" end if end if If IsDataVideo( MarkerText ) OR (sType = 6) Then gDataVideo = True Else gDataVideo = False End If PlayObjects objs, False, gDataVideo DoPrivateMarker PrevIndex, gCurListIndex DoSlideObject( ListIndex ) End Sub Sub DoPrivateMarker(PrevIndex, SlideIndex) If not gIsLoadEst Then exit Sub If not (PrevIndex=1 and SlideIndex=1) Then ViewerUtil.NoteSetMarkers PrevIndex, gPMarkers gNoteDirty = True End if gPMarkers = ViewerUtil.NoteGetMarkers(SlideIndex) If gPMarkers = "" Then exit Sub objs = gPMarkers & "," pos = InStr( objs, "," ) while pos <> 0 t = Left( objs, pos-1 ) if t<>"" then sn2.PlayObject CLng(t), False objs = Right( objs, len(objs)-pos ) pos = InStr( objs, "," ) wend End Sub Sub ShowSlideNumber(curNum) if not IsObj( PageLayer ) then exit Sub strNumber = "SLIDE " & curNum & " / TOTAL " & gListNum If ( not LiveMode ) Then strNumber = strNumber & " (" & FormatTime(jsParseInt(MP_Duration())) & ")" End If PageLayer.innerHTML = strNumber End Sub Sub MyInitLayers SaveRect gSlideRect, SlideLayer SaveRect gInitSlideRect, SlideLayer VideoLayer.style.posWidth = MediaPlayer1.style.posWidth VideoLayer.style.posHeight = MediaPlayer1.style.posHeight SaveRect gVideoRect, VideoLayer SaveRect gInitVideoRect, VideoLayer SaveRect gVideoControlRect, VideoControl SaveRect gEllapseRect, Ellapse SaveRect gEllapseRect2, Ellapse SaveRect gMuteRect, MuteLayer SaveRect gSlideControlRect, SlideControl SaveRect gNoteRect, NoteLayer SaveRect gTrackPosRect, TrackPos SaveRect gTrackRect, Track gVideoControlRect2(1) = VideoControl_posLeft2 gVideoControlRect2(2) = VideoControl_posTop2 gEllapseRect2(1) = Ellapse_posLeft2 gEllapseRect2(2) = Ellapse_posTop2 gMuteRect2(1) = Mute_posLeft2 gMuteRect2(2) = Mute_posTop2 gSlideControlRect2(1) = SlideControl_posLeft2 gSlideControlRect2(2) = SlideControl_posTop2 gNoteRect2(1) = Note_posLeft2 gNoteRect2(2) = Note_posTop2 SaveRect gTrackRect2, Track gTrackRect2(1) = Track_posLeft2 gTrackRect2(2) = Track_posTop2 SaveRect gTrackPosRect2, TrackPos gTrackPosRect2(1) = TrackPos_posLeft2 gTrackPosRect2(2) = TrackPos_posTop2 ' SavePos gBgVideoBoxPos, bgVideoBox SavePos gBgContentsBoxPos, bgContentsBox SavePos gBgSlideBoxPos, bgSlideBox SavePos gTopLogoPos, topLogo SavePos gTitleVideoPos, tit_Video SavePos gTitleSlidePos, tit_Slide SavePos gTitleContentsPos, tit_Contents SavePos gVideoTablePos, table_Video SavePos gSlideTablePos, table_Slide SavePos gListTablePos, ListBorder SavePos gPageTablePos, table_Page SavePos gBgBottomPos, bgBottom SavePos gHLine1Pos, bg_HLine1 SavePos gHLine2Pos, bg_HLine2 SavePos gHLine3Pos, bg_HLine3 SavePos gHLine4Pos, bg_HLine4 SavePos gHLine5Pos, bg_HLine5 SavePos gVLine1Pos, bg_VLine1 SavePos gVLine2Pos, bg_VLine2 SavePos gVLine3Pos, bg_VLine3 SavePos gVLine4Pos, bg_LiveLine SavePos gListPos, ListLayer SavePos gPagePos, PageLayer SavePos gInfoPos, Info SavePos gQuestionPos, Question SavePos gSwapPos, Swap SavePos gVideoMaxPos, VideoMax SavePos gSlideMaxPos, SlideMax SavePos gPrintPos, Printbtn SavePos gHelpPos, Help End Sub Sub FindCurrentSlide( ByRef ListIndex, ByRef SlideMarker ) Dim index, mn ListIndex=0 SlideMarker = "" for index=0 to gEventNum-1 if GetEventTime(index) > MP_CurrentPosition() * 1000 then exit for mn = GetEventItem(index) if LCase(Left(mn,5)) = "slide" then ListIndex = ListIndex + 1 SlideMarker = mn end if next End Sub Sub SaveRect( rect, obj ) If not IsObj(obj) Then exit Sub rect(1) = obj.Style.posLeft rect(2) = obj.Style.posTop rect(3) = obj.Style.posWidth rect(4) = obj.Style.posHeight End Sub Sub LoadRect( obj, rect ) If not IsObj(obj) Then exit Sub obj.Style.posLeft = rect(1) obj.Style.posTop = rect(2) obj.Style.posWidth = rect(3) obj.Style.posHeight = rect(4) End Sub Sub DoSlideObject( ListIndex ) if not gXmlLoad then exit sub objs = "" query = "lecture/slide[seq=" & ListIndex & "]/object" Set nodes = SlideList.XMLDocument.selectNodes(query) if nodes.length > 0 then Set node = SlideList.XMLDocument.selectSingleNode(query) objs = node.text end if PlayObjects objs, False, False End Sub Sub GetVideoMetadata( ListIndex, volume, main_pause ) volume = "" mian_pause = "" if Not IsObj(SlideList) then exit sub if SlideList.XMLDocument.parseError <> 0 then exit sub if ListIndex = -1 then query = "lecture/main_volume" Set nodes = SlideList.XMLDocument.selectNodes(query) if nodes.length > 0 then Set node = SlideList.XMLDocument.selectSingleNode(query) volume = node.text end if exit sub end if query = "lecture/slide[seq=" & ListIndex & "]/volume" Set nodes = SlideList.XMLDocument.selectNodes(query) if nodes.length > 0 then Set node = SlideList.XMLDocument.selectSingleNode(query) volume = node.text end if query = "lecture/slide[seq=" & ListIndex & "]/main_pause" Set nodes = SlideList.XMLDocument.selectNodes(query) if nodes.length > 0 then Set node = SlideList.XMLDocument.selectSingleNode(query) main_pause = node.text end if End Sub Sub OnBuffering( Start ) if Start=True then clearTimeout gEventTimeoutId if gReservePause then gReservePause = False gReservePause2 = True end if else StartTimer gEventCur if gReservePause2 then gReservePause2 = False SetTimeout "ReservePause()", 100 end if end if End Sub Function document_onmousemove() ' Exit Function window.status = window.event.clientX & "," & (screen.availWidth - 20) if gIsSlideFull and window.event.clientX > screen.availWidth - 20 and ListLayer.style.display = "none" then ShowLayer ListLayer ListLayer.style.zIndex = 2 SlideLayer.style.zIndex = 1 end if End Function ' Function getStartPos( mode ) Dim s Select Case mode Case "w" s = document.body.clientWidth - viewerWidth Case "h" s = document.body.clientHeight - viewerHeight Case Else s = 0 End Select If (s > 0) Then getStartPos = s / 2 Else getStartPos = 0 End If End Function Sub UpdateSize () If (gIsSlideFull = True) Then Exit Sub w = getStartPos("w") h = getStartPos("h") 'If (w = 0 and h = 0) Then Exit Sub If IsObj(ViewerBorder) Then ViewerBorder.style.posLeft = w - 1 ViewerBorder.style.posTop = h - 1 End If If IsObj(TopLayer) Then TopLayer.style.posLeft = w TopLayer.style.posTop = h End If MovePos gBgVideoBoxPos, bgVideoBox, w, h MovePos gBgContentsBoxPos, bgContentsBox, w, h MovePos gBgSlideBoxPos, bgSlideBox, w, h MovePos gTopLogoPos, topLogo, w, h MovePos gTitleVideoPos, tit_Video, w, h MovePos gTitleSlidePos, tit_Slide, w, h MovePos gTitleContentsPos, tit_Contents, w, h 'MovePos gVideoTablePos, table_Video, w, h 'MovePos gSlideTablePos, table_Slide, w, h MovePos gBgTopPos, bgTop, w, h MovePos gBgBottomPos, bgBottom, w, h MovePos gHLine1Pos, bg_HLine1, w, h MovePos gHLine2Pos, bg_HLine2, w, h MovePos gHLine3Pos, bg_HLine3, w, h MovePos gHLine4Pos, bg_HLine4, w, h MovePos gHLine5Pos, bg_HLine5, w, h MovePos gVLine1Pos, bg_VLine1, w, h MovePos gVLine2Pos, bg_VLine2, w, h MovePos gVLine3Pos, bg_VLine3, w, h MovePos gVLine4Pos, bg_LiveLine, w, h MovePos gQuestionPos, Question, w, h MovePos gSwapPos, Swap, w, h MovePos gVideoMaxPos, VideoMax, w, h MovePos gSlideMaxPos, SlideMax, w, h MovePos gPrintPos, Printbtn, w, h MovePos gHelpPos, Help, w, h MovePos gVideoTablePos, table_Video, w, h MovePos gSlideTablePos, table_Slide, w, h MovePos gListTablePos, ListBorder, w, h MovePos gPageTablePos, table_Page, w, h MovePos gPagePos, PageLayer, w, h MovePos gListPos, ListLayer, w, h MovePos gInfoPos, Info, w, h If (gZoomState = 2) Then MovePos gSlideControlRect2, SlideControl, w, h MovePos gNoteRect2, NoteLayer, w, h MovePos gInitSlideRect, VideoLayer, w, h MovePos gInitVideoRect, SlideLayer, w, h MovePos gInitSlideRect, VideoLogoLayer, w, h Else MovePos gSlideControlRect, SlideControl, w, h MovePos gNoteRect, NoteLayer, w, h MovePos gInitVideoRect, VideoLayer, w, h MovePos gInitSlideRect, SlideLayer, w, h MovePos gInitVideoRect, VideoLogoLayer, w, h End If SaveRect gSlideRect, SlideLayer SaveRect gVideoRect, VideoLayer If IsObj(SlideTitle) Then SlideTitle.style.posLeft = SlideLayer.style.posLeft SlideTitle.style.posTop = SlideLayer.style.posTop + SlideLayer.style.posHeight + 1 SlideTitle.style.posWidth = SlideLayer.style.posWidth End If End Sub Sub SavePos ( posArr, obj ) If not IsObj(obj) Then Exit Sub posArr(1) = obj.style.posLeft posArr(2) = obj.style.posTop End Sub Sub MovePos ( posArr, obj, offsetX, offsetY) If not IsObj(obj) Then Exit Sub If UBound(posArr) = 0 Then Exit Sub obj.style.posLeft = posArr(1) + offsetX obj.style.posTop = posArr(2) + offsetY End Sub Sub SetSlideTitlePos () SlideTitle.style.posLeft = SlideLayer.style.posLeft SlideTitle.style.posTop = SlideLayer.style.posTop + SlideLayer.style.posHeight + 1 SlideTitle.style.posWidth = SlideLayer.style.posWidth End Sub